Επεξεργασία

Κοινή χρήση μέσω


ColorConverter.ConvertFrom Method

Definition

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

public:
 override System::Object ^ ConvertFrom(System::ComponentModel::ITypeDescriptorContext ^ context, System::Globalization::CultureInfo ^ culture, System::Object ^ value);
public override object ConvertFrom (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value);
public override object? ConvertFrom (System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object value);
override this.ConvertFrom : System.ComponentModel.ITypeDescriptorContext * System.Globalization.CultureInfo * obj -> obj
Public Overrides Function ConvertFrom (context As ITypeDescriptorContext, culture As CultureInfo, value As Object) As Object

Parameters

context
ITypeDescriptorContext

A TypeDescriptor that provides a format context. You can use this object to get additional information about the environment from which this converter is being invoked.

culture
CultureInfo

A CultureInfo that specifies the culture to represent the color.

value
Object

The object to convert.

Returns

An Object representing the converted value.

Exceptions

The conversion cannot be performed.

Remarks

When converting from a string to a Color the ColorConverter expects the unqualified color name; otherwise, an exception will occur in the conversion process. For example, you should pass "Blue", not "System.Drawing.Color.Blue" or "Color.Blue", to the ConvertFrom method.

Applies to