ImageFormatConverter

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

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

An optional format context that can provide additional information.

sourceType

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

An optional format context that can provide additional information.

destinationType

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

An optional format context that can provide additional information.

culture

The culture to use for conversion.

value

The value to convert.

Returns: Object. An ImageFormat object that represents the converted value.

Throws:

ConvertTo(context, culture, value, destinationType)

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

Parameter
Type
Description

context

An optional format context that can provide additional information.

culture

The culture to use for conversion.

value

The ImageFormat object to convert.

destinationType

The type to convert to.

Returns: Object. An object representing the converted value.

Throws:

GetStandardValues(context)

Returns a collection of standard ImageFormat values supported by this converter.

Parameter
Type
Description

context

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

An optional format context that can provide additional information.

Returns: Boolean. true if standard values are supported; otherwise, false.

Last updated

Was this helpful?