Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Drawing.​RectangleConverter

Assembly: System.ComponentModel.TypeConverter

Inheritance: object → ComponentModel.​TypeConverter → RectangleConverter

Converts rectangles from one data type to another. Access this class through the <see cref="T:System.ComponentModel.TypeDescriptor" /> .

Methods

public bool
CanConvertFrom​(ComponentModel.​ITypeDescriptorContext? context, Type sourceType)
Determines if this converter can convert an object in the given source type to the native type of the converter.
Returns This method returns <see langword="true" /> if this object can perform the conversion; otherwise, <see langword="false" /> .
context A formatter context. This object can be used to get additional information about the environment this converter is being called from. This may be <see langword="null" /> , so you should always check. Also, properties on the context object may also return <see langword="null" /> .
sourceType The type you want to convert from.
public bool
CanConvertTo​(ComponentModel.​ITypeDescriptorContext context, Type destinationType)
Gets a value indicating whether this converter can convert an object to the given destination type using the context.
Returns This method returns <see langword="true" /> if this converter can perform the conversion; otherwise, <see langword="false" /> .
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> object that provides a format context. This can be <see langword="null" /> , so you should always check. Also, properties on the context object can also return <see langword="null" /> .
destinationType A <see cref="T:System.Type" /> object that represents the type you want to convert to.
public object
ConvertFrom​(ComponentModel.​ITypeDescriptorContext context, Globalization.​CultureInfo culture, object value)
Converts the given object to a <see cref="T:System.Drawing.Rectangle" /> object.
Returns The converted object.
context A <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that can be used to get additional information about the environment this converter is being called from. This may be <see langword="null" /> , so you should always check. Also, properties on the context object may also return <see langword="null" /> .
culture An <see cref="T:System.Globalization.CultureInfo" /> that contains culture specific information, such as the language, calendar, and cultural conventions associated with a specific culture. It is based on the RFC 1766 standard.
value The object to convert.
public object
ConvertTo​(ComponentModel.​ITypeDescriptorContext context, Globalization.​CultureInfo culture, object value, Type destinationType)
Converts the specified object to the specified type.
Returns The converted object.
context A <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that can be used to get additional information about the environment this converter is being called from. This may be <see langword="null" /> , so you should always check. Also, properties on the context object may also return <see langword="null" /> .
culture An <see cref="T:System.Globalization.CultureInfo" /> that contains culture specific information, such as the language, calendar, and cultural conventions associated with a specific culture. It is based on the RFC 1766 standard.
value The object to convert.
destinationType The type to convert the object to.
public object
CreateInstance​(ComponentModel.​ITypeDescriptorContext? context, Collections.​IDictionary propertyValues)
Creates an instance of this type given a set of property values for the object. This is useful for objects that are immutable but still want to provide changeable properties.
Returns The newly created object, or <see langword="null" /> if the object could not be created. The default implementation returns <see langword="null" /> .
context A <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> through which additional context can be provided.
propertyValues A dictionary of new property values. The dictionary contains a series of name-value pairs, one for each property returned from a call to the <see cref="M:System.Drawing.RectangleConverter.GetProperties(System.ComponentModel.ITypeDescriptorContext,System.Object,System.Attribute[])" /> method.
public bool
GetCreateInstanceSupported​(ComponentModel.​ITypeDescriptorContext context)
Determines if changing a value on this object should require a call to <see cref="M:System.Drawing.RectangleConverter.CreateInstance(System.ComponentModel.ITypeDescriptorContext,System.Collections.IDictionary)" /> to create a new value.
Returns This method returns <see langword="true" /> if <see cref="M:System.Drawing.RectangleConverter.CreateInstance(System.ComponentModel.ITypeDescriptorContext,System.Collections.IDictionary)" /> should be called when a change is made to one or more properties of this object; otherwise, <see langword="false" /> .
context A type descriptor through which additional context can be provided.
GetProperties​(ComponentModel.​ITypeDescriptorContext context, object value, Attribute[] attributes)
Retrieves the set of properties for this type. By default, a type does not return any properties.
Returns The set of properties that should be exposed for this data type. If no properties should be exposed, this may return <see langword="null" /> . The default implementation always returns <see langword="null" /> .
context A <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> through which additional context can be provided.
value The value of the object to get the properties for.
attributes An array of <see cref="T:System.Attribute" /> objects that describe the properties.
public bool
GetPropertiesSupported​(ComponentModel.​ITypeDescriptorContext context)
Determines if this object supports properties. By default, this is <see langword="false" /> .
Returns This method returns <see langword="true" /> if <see cref="M:System.Drawing.RectangleConverter.GetProperties(System.ComponentModel.ITypeDescriptorContext,System.Object,System.Attribute[])" /> should be called to find the properties of this object; otherwise, <see langword="false" /> .
context A <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> through which additional context can be provided.
public bool
CanConvertFrom​(Type sourceType)
Returns whether this converter can convert an object of the given type to the type of this converter.
Returns <see langword="true" /> if this converter can perform the conversion; otherwise, <see langword="false" /> .
sourceType A <see cref="T:System.Type" /> that represents the type you want to convert from.
public bool
CanConvertTo​(Type destinationType)
Returns whether this converter can convert the object to the specified type.
Returns <see langword="true" /> if this converter can perform the conversion; otherwise, <see langword="false" /> .
destinationType A <see cref="T:System.Type" /> that represents the type you want to convert to.
public object
ConvertFrom​(object value)
Converts the given value to the type of this converter.
Returns An <see cref="T:System.Object" /> that represents the converted value.
value The <see cref="T:System.Object" /> to convert.
public object
ConvertFromInvariantString​(ComponentModel.​ITypeDescriptorContext context, string text)
Converts the given string to the type of this converter, using the invariant culture and the specified context.
Returns An <see cref="T:System.Object" /> that represents the converted text.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
text The <see cref="T:System.String" /> to convert.
public object
ConvertFromInvariantString​(string text)
Converts the given string to the type of this converter, using the invariant culture.
Returns An <see cref="T:System.Object" /> that represents the converted text.
text The <see cref="T:System.String" /> to convert.
public object
ConvertFromString​(ComponentModel.​ITypeDescriptorContext context, Globalization.​CultureInfo culture, string text)
Converts the given text to an object, using the specified context and culture information.
Returns An <see cref="T:System.Object" /> that represents the converted text.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
culture A <see cref="T:System.Globalization.CultureInfo" /> . If <see langword="null" /> is passed, the current culture is assumed.
text The <see cref="T:System.String" /> to convert.
public object
ConvertFromString​(ComponentModel.​ITypeDescriptorContext context, string text)
Converts the given text to an object, using the specified context.
Returns An <see cref="T:System.Object" /> that represents the converted text.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
text The <see cref="T:System.String" /> to convert.
public object
ConvertFromString​(string text)
Converts the specified text to an object.
Returns An <see cref="T:System.Object" /> that represents the converted text.
text The text representation of the object to convert.
public object
ConvertTo​(object value, Type destinationType)
Converts the given value object to the specified type, using the arguments.
Returns An <see cref="T:System.Object" /> that represents the converted value.
value The <see cref="T:System.Object" /> to convert.
destinationType The <see cref="T:System.Type" /> to convert the <paramref name="value" /> parameter to.
public string
ConvertToInvariantString​(ComponentModel.​ITypeDescriptorContext context, object value)
Converts the specified value to a culture-invariant string representation, using the specified context.
Returns A <see cref="T:System.String" /> that represents the converted value.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value The <see cref="T:System.Object" /> to convert.
public string
ConvertToInvariantString​(object value)
Converts the specified value to a culture-invariant string representation.
Returns A <see cref="T:System.String" /> that represents the converted value.
value The <see cref="T:System.Object" /> to convert.
public string
ConvertToString​(ComponentModel.​ITypeDescriptorContext context, Globalization.​CultureInfo culture, object value)
Converts the given value to a string representation, using the specified context and culture information.
Returns An <see cref="T:System.Object" /> that represents the converted value.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
culture A <see cref="T:System.Globalization.CultureInfo" /> . If <see langword="null" /> is passed, the current culture is assumed.
value The <see cref="T:System.Object" /> to convert.
public string
ConvertToString​(ComponentModel.​ITypeDescriptorContext context, object value)
Converts the given value to a string representation, using the given context.
Returns An <see cref="T:System.Object" /> that represents the converted value.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value The <see cref="T:System.Object" /> to convert.
public string
ConvertToString​(object value)
Converts the specified value to a string representation.
Returns An <see cref="T:System.Object" /> that represents the converted value.
value The <see cref="T:System.Object" /> to convert.
public object
CreateInstance​(Collections.​IDictionary propertyValues)
Re-creates an <see cref="T:System.Object" /> given a set of property values for the object.
Returns An <see cref="T:System.Object" /> representing the given <see cref="T:System.Collections.IDictionary" /> , or <see langword="null" /> if the object cannot be created. This method always returns <see langword="null" /> .
propertyValues An <see cref="T:System.Collections.IDictionary" /> that represents a dictionary of new property values.
protected Exception
GetConvertFromException​(object value)
Returns an exception to throw when a conversion cannot be performed.
Returns An <see cref="T:System.Exception" /> that represents the exception to throw when a conversion cannot be performed.
value The <see cref="T:System.Object" /> to convert, or <see langword="null" /> if the object is not available.
protected Exception
GetConvertToException​(object value, Type destinationType)
Returns an exception to throw when a conversion cannot be performed.
Returns An <see cref="T:System.Exception" /> that represents the exception to throw when a conversion cannot be performed.
value The <see cref="T:System.Object" /> to convert, or <see langword="null" /> if the object is not available.
destinationType A <see cref="T:System.Type" /> that represents the type the conversion was trying to convert to.
public bool
GetCreateInstanceSupported​()
Returns whether changing a value on this object requires a call to the <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)" /> method to create a new value.
Returns <see langword="true" /> if changing a property on this object requires a call to <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)" /> to create a new value; otherwise, <see langword="false" /> .
GetProperties​(ComponentModel.​ITypeDescriptorContext context, object value)
Returns a collection of properties for the type of array specified by the value parameter, using the specified context.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or <see langword="null" /> if there are no properties.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.
GetProperties​(object value)
Returns a collection of properties for the type of array specified by the value parameter.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or <see langword="null" /> if there are no properties.
value An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.
public bool
GetPropertiesSupported​()
Returns whether this object supports properties.
Returns <see langword="true" /> if <see cref="M:System.ComponentModel.TypeConverter.GetProperties(System.Object)" /> should be called to find the properties of this object; otherwise, <see langword="false" /> .
GetStandardValues​()
Returns a collection of standard values from the default context for the data type this type converter is designed for.
Returns A <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> containing a standard set of valid values, or <see langword="null" /> if the data type does not support a standard set of values.
GetStandardValues​(ComponentModel.​ITypeDescriptorContext context)
Returns a collection of standard values for the data type this type converter is designed for when provided with a format context.
Returns A <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> that holds a standard set of valid values, or <see langword="null" /> if the data type does not support a standard set of values.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be <see langword="null" /> .
public bool
GetStandardValuesExclusive​()
Returns whether the collection of standard values returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exclusive list.
Returns <see langword="true" /> if the <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exhaustive list of possible values; <see langword="false" /> if other values are possible.
public bool
GetStandardValuesExclusive​(ComponentModel.​ITypeDescriptorContext context)
Returns whether the collection of standard values returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exclusive list of possible values, using the specified context.
Returns <see langword="true" /> if the <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exhaustive list of possible values; <see langword="false" /> if other values are possible.
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
public bool
GetStandardValuesSupported​()
Returns whether this object supports a standard set of values that can be picked from a list.
Returns <see langword="true" /> if <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> should be called to find a common set of values the object supports; otherwise, <see langword="false" /> .
public bool
GetStandardValuesSupported​(ComponentModel.​ITypeDescriptorContext context)
Returns whether this object supports a standard set of values that can be picked from a list, using the specified context.
Returns <see langword="true" /> if <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> should be called to find a common set of values the object supports; otherwise, <see langword="false" /> .
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
public bool
IsValid​(ComponentModel.​ITypeDescriptorContext context, object value)
Returns whether the given value object is valid for this type and for the specified context.
Returns <see langword="true" /> if the specified value is valid for this object; otherwise, <see langword="false" /> .
context An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.
value The <see cref="T:System.Object" /> to test for validity.
public bool
IsValid​(object value)
Returns whether the given value object is valid for this type.
Returns <see langword="true" /> if the specified value is valid for this object; otherwise, <see langword="false" /> .
value The object to test for validity.
SortProperties​(ComponentModel.​PropertyDescriptorCollection props, string[] names)
Sorts a collection of properties.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> that contains the sorted properties.
props A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> that has the properties to sort.
names An array of names in the order you want the properties to appear in the collection.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object