OpacityConverter.ConvertTo Method (ITypeDescriptorContext, CultureInfo, Object, Type)


Converts from the converter's native type to a value of the destination type.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public override object ConvertTo(
	ITypeDescriptorContext context,
	CultureInfo culture,
	object value,
	Type destinationType


Type: System.ComponentModel.ITypeDescriptorContext

A ITypeDescriptorContext that provides information about the context of a type converter.

Type: System.Globalization.CultureInfo

The locale information for the conversion.

Type: System.Object

The value to convert.

Type: System.Type

The type to convert the object to.

Return Value

Type: System.Object

An Object that represents the converted value.

Exception Condition

destinationType is null.


value cannot be converted to the destinationType.

The ConvertTo method is specialized to convert integral values to their String percentage representations. Other types are passed to the base class implementation of this method.

Notes to Inheritors:

Override this method to provide your own conversion requirements.

You can use the context parameter to extract additional information about the environment this converter is being invoked from. The parameter may be null, so you should always verify the contents. Also, properties on the ITypeDescriptorContext may also return null.

The resultant object is a String representing the percentage of opacity.

.NET Framework
Available since 1.1
Return to top