Export (0) Print
Expand All

OpacityConverter.ConvertFrom Method (ITypeDescriptorContext, CultureInfo, Object)

Converts the specified object to the converter's native type.

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

public override Object ConvertFrom(
	ITypeDescriptorContext context,
	CultureInfo culture,
	Object value
)

Parameters

context
Type: System.ComponentModel.ITypeDescriptorContext

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

culture
Type: System.Globalization.CultureInfo

The locale information for the conversion.

value
Type: System.Object

The object to convert.

Return Value

Type: System.Object
An Object that represents the converted value.

ExceptionCondition
Exception

The object was not a supported type for the conversion.

FormatException

value could not be properly converted to type Double.

-or-

The resulting converted value was less than zero percent or greater than one hundred percent.

The ConvertFrom method is specialized to convert String values that represent percentages or decimal fractions to their corresponding Double values, which represent the opacity as a percentage. Types other than String 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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft