ImageConverter
Namespace: System.Drawing
Assembly: System.Drawing.Managed (4.0.0.0)
Provides a type converter to convert Image objects to and from various other representations. This class supports conversion from byte arrays to Image objects and vice versa.
- C#
- VB.NET
public class ImageConverter : TypeConverter
Public Class ImageConverter
Inherits TypeConverter
Constructors
ImageConverter()
Initializes a new instance of ImageConverter.
Methods
CanConvertFrom(context, sourceType)
Determines whether this converter can convert an object of the specified type to an Image, using the specified context.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An ITypeDescriptorContext that provides a format context. |
| sourceType | Type | The Type to evaluate for conversion. |
Returns: Boolean. if the conversion is possible; otherwise, .
CanConvertTo(context, destinationType)
Determines whether this converter can convert an Image to the specified type, using the specified context.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An ITypeDescriptorContext that provides a format context. |
| destinationType | Type | The Type to evaluate for conversion. |
Returns: Boolean. if the conversion is possible; otherwise, .
ConvertFrom(context, culture, value)
Converts the given object to an Image object, using the specified context and culture information.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An ITypeDescriptorContext that provides a format context. |
| culture | CultureInfo | The CultureInfo to use during conversion. |
| value | Object | The object to convert. |
Returns: Object. An Image object, or if the conversion cannot be performed.
Throws:
- NotSupportedException Thrown if the conversion cannot be performed.
ConvertTo(context, culture, value, destinationType)
Converts the given Image object to another type, using the specified context and culture information.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An ITypeDescriptorContext that provides a format context. |
| culture | CultureInfo | The CultureInfo to use during conversion. |
| value | Object | The Image object to convert. |
| destinationType | Type | The Type to convert the object to. |
Returns: Object. The converted object.
Throws:
- NotSupportedException Thrown if the conversion cannot be performed.
GetProperties(context, value, attributes)
Retrieves the set of properties for the Image type. By default, this method returns the properties of the Image type.
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An ITypeDescriptorContext that provides a format context. |
| value | Object | The object to retrieve properties for. |
| attributes | Attribute[] | An array of Attribute objects to filter the properties. |
Returns: PropertyDescriptorCollection. A PropertyDescriptorCollection containing the properties of the Image type.
GetPropertiesSupported(context)
Determines whether this object supports properties. This implementation always returns .
| Parameter | Type | Description |
|---|---|---|
| context | ITypeDescriptorContext | An ITypeDescriptorContext that provides a format context. |
Returns: Boolean. if properties are supported; otherwise, .