ImageFormatConverter
Namespace: System.Drawing
Assembly: System.Drawing.Managed (4.0.0.0)
Provides a type converter to convert ImageFormat objects to and from various other representations, such as strings and instance descriptors.
- C#
- VB.NET
public class ImageFormatConverter : TypeConverter
Public Class ImageFormatConverter
Inherits TypeConverter
Constructors
ImageFormatConverter()
Initializes a new instance of ImageFormatConverter.
Methods
CanConvertFrom(context, sourceType)
Returns whether this converter can convert an object of the given type to an ImageFormat, using the specified context.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An optional format context that can provide additional information. |
| sourceType | Type | The type to convert from. |
Returns: Boolean. true if conversion is possible; otherwise, false.
CanConvertTo(context, destinationType)
Returns whether this converter can convert an ImageFormat to the specified destination type, using the given context.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An optional format context that can provide additional information. |
| destinationType | Type | The type to convert to. |
Returns: Boolean. true if conversion is possible; otherwise, false.
ConvertFrom(context, culture, value)
Converts the specified value to an ImageFormat object, using the provided context and culture information.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An optional format context that can provide additional information. |
| culture | CultureInfo | The culture to use for conversion. |
| value | Object | The value to convert. |
Returns: Object. An ImageFormat object that represents the converted value.
Throws:
- FormatException Thrown if the value cannot be converted to an ImageFormat.
ConvertTo(context, culture, value, destinationType)
Converts the given ImageFormat object to another type, using the specified context and culture information.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An optional format context that can provide additional information. |
| culture | CultureInfo | The culture to use for conversion. |
| value | Object | The ImageFormat object to convert. |
| destinationType | Type | The type to convert to. |
Returns: Object. An object representing the converted value.
Throws:
- NotSupportedException Thrown if the conversion cannot be performed.
GetStandardValues(context)
Returns a collection of standard ImageFormat values supported by this converter.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An optional format context that can provide additional information. |
Returns: StandardValuesCollection. A StandardValuesCollection containing the standard ImageFormat values, or null if the data type does not support a standard set of values.
GetStandardValuesSupported(context)
Returns whether this object supports a standard set of values that can be picked from a list.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An optional format context that can provide additional information. |
Returns: Boolean. true if standard values are supported; otherwise, false.