Returns a collection of properties for the type of array specified by the value parameter, using the specified context. GetProperties(ITypeDescriptorContext, Object) Returns whether changing a value on this object requires a call to CreateInstance(IDictionary) to create a new value, using the specified context. GetCreateInstanceSupported(ITypeDescriptorContext) Returns whether changing a value on this object requires a call to the CreateInstance(IDictionary) method to create a new value. Returns an exception to throw when a conversion cannot be performed. Re-creates an Object given a set of property values for the object.ĬreateInstance(ITypeDescriptorContext, IDictionary)Ĭreates an instance of the type that this TypeConverter is associated with, using the specified context, given a set of property values for the object.ĭetermines whether the specified object is equal to the current object. Returns whether this converter can convert the object to the specified type.ĬonvertFrom(ITypeDescriptorContext, CultureInfo, Object)Ĭonverts the given object to the converter's native type.Ĭonverts the given value to the type of this converter.ĬonvertFromInvariantString(ITypeDescriptorContext, String)Ĭonverts the given string to the type of this converter, using the invariant culture and the specified context.Ĭonverts the given string to the type of this converter, using the invariant culture.ĬonvertFromString(ITypeDescriptorContext, CultureInfo, String)Ĭonverts the given text to an object, using the specified context and culture information.ĬonvertFromString(ITypeDescriptorContext, String)Ĭonverts the given text to an object, using the specified context.Ĭonverts the specified text to an object.ĬonvertTo(ITypeDescriptorContext, CultureInfo, Object, Type)Ĭonverts the specified object to another type.Ĭonverts the given value object to the specified type, using the arguments.ĬonvertToInvariantString(ITypeDescriptorContext, Object)Ĭonverts the specified value to a culture-invariant string representation, using the specified context.Ĭonverts the specified value to a culture-invariant string representation.ĬonvertToString(ITypeDescriptorContext, CultureInfo, Object)Ĭonverts the given value to a string representation, using the specified context and culture information.ĬonvertToString(ITypeDescriptorContext, Object)Ĭonverts the given value to a string representation, using the given context.Ĭonverts the specified value to a string representation. Returns a value indicating whether this converter can convert an object to the given destination type using the context. Returns whether this converter can convert an object of the given type to the type of this converter.ĬanConvertTo(ITypeDescriptorContext, Type) Initializes a new instance of the ColorConverter class.ĬanConvertFrom(ITypeDescriptorContext, Type)ĭetermines if this converter can convert an object in the given source type to the native type of the converter.
For example, you should pass "Blue", not "" or "Color.Blue", to the ConvertFrom method. When converting from a string to a Color the ColorConverter expects the unqualified color name otherwise, an exception will occur in the conversion process. (m圜olor)Ĭonverter.ConvertToString(Color.PaleVioletRed)Į.Graphics.DrawString(colorAsString, Me.Font, _ Private Sub ShowColorConverter(ByVal e As PaintEventArgs)ĭim m圜olor As Color = Color.PaleVioletRedĭim converter As = _ String colorAsString = converter.ConvertToString(Color.PaleVioletRed) Į.Graphics.DrawString(colorAsString, this.Font, Private void ShowColorConverter(PaintEventArgs e) String^ colorAsString = converter->ConvertToString( Color::PaleVioletRed ) Į->Graphics->DrawString( colorAsString, this->Font, Brushes::PaleVioletRed, 50.0F, 50.0F ) System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( m圜olor ) void ShowColorConverter( PaintEventArgs^ e )
#VB.NET COLORCONVERTER CODE#
Paste this code into a form and call the ShowColorConverter method when handling the form's Paint event, passing e as PaintEventArgs.
#VB.NET COLORCONVERTER WINDOWS#
This example is designed to be used with Windows Forms.
#VB.NET COLORCONVERTER HOW TO#
The following code example demonstrates how to use the ConvertToString method.