ImageConverter

System.Drawing.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.

public class ImageConverter : 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

An ITypeDescriptorContext that provides a format context.

sourceType

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

An ITypeDescriptorContext that provides a format context.

destinationType

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

An ITypeDescriptorContext that provides a format context.

culture

The CultureInfo to use during conversion.

value

The object to convert.

Returns: Object. An Image object, or if the conversion cannot be performed.

Throws:

ConvertTo(context, culture, value, destinationType)

Converts the given Image object to another type, using the specified context and culture information.

Parameter
Type
Description

context

An ITypeDescriptorContext that provides a format context.

culture

The CultureInfo to use during conversion.

value

The Image object to convert.

destinationType

The Type to convert the object to.

Returns: Object. The converted object.

Throws:

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

An ITypeDescriptorContext that provides a format context.

value

The object to retrieve properties for.

attributes

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

An ITypeDescriptorContext that provides a format context.

Returns: Boolean. if properties are supported; otherwise, .

Last updated

Was this helpful?