WebColorConverter 類別
定義
public ref class WebColorConverter : System::Drawing::ColorConverter
public class WebColorConverter : System.Drawing.ColorConverter
type WebColorConverter = class
inherit ColorConverter
Public Class WebColorConverter
Inherits ColorConverter
- 繼承
備註
WebColorConverter類別是用來將物件轉換 System.Drawing.Color 成預先定義的色彩名稱或 RGB 色彩值。The WebColorConverter class is used to convert a System.Drawing.Color object to a predefined color name or an RGB color value. 它也可用來將預先定義的色彩名稱或 RGB 色彩值轉換成 System.Drawing.Color 物件。It is also used to convert a predefined color name or an RGB color value to a System.Drawing.Color object.
警告
您不應該直接存取類型轉換器。You should never access a type converter directly. 相反地,請使用來呼叫適當的轉換器 System.ComponentModel.TypeDescriptor 。Instead, call the appropriate converter by using System.ComponentModel.TypeDescriptor. 如需詳細資訊,請參閱 System.ComponentModel.TypeConverter 類別概觀中的範例。For more information, see the examples in the System.ComponentModel.TypeConverter class overview.
下列清單包含您可以使用的十六個預先定義 HTML 色彩名稱:The following list contains the sixteen predefined HTML color names you can use:
黑色Black
藍色Blue
11:青色Cyan
灰色Gray
綠色Green
檸檬Lime
桃紅色Magenta
暗紅色Maroon
深藍色Navy
色Olive
紫色Purple
紅色Red
銀卡Silver
藍綠色Teal
白色White
黃色Yellow
您也可以使用十六進位數位(前面加上井字型大小字元 ( # ) )指定自訂色彩,格式為 #RRGGBB
。You can also specify a custom color by using a hexadecimal number, preceded by the pound character (#), in the form #RRGGBB
. RR
、 GG
和 BB
代表從0到255的十六進位值,分別表示色彩的紅色、綠色和藍色元件。RR
, GG
, and BB
represent hexadecimal values from 0 to 255 that indicate the red, green, and blue components of a color, respectively. 例如,此值 #0000FF
代表藍色。For example, the value #0000FF
represents the color blue. 它會指定 00
紅色和綠色元件 () 的最小值,同時指定藍色元件的最大值 (FF
) 。It specifies the minimum value (00
) for the red and green components, while specifying the maximum value (FF
) for the blue component.
建構函式
WebColorConverter() |
初始化 WebColorConverter 類別的新執行個體。Initializes a new instance of the WebColorConverter class. |
方法
CanConvertFrom(ITypeDescriptorContext, Type) |
判斷這個轉換子是否可以將指定來源型別中的物件轉換成轉換子的原生型別。Determines if this converter can convert an object in the given source type to the native type of the converter. (繼承來源 ColorConverter) |
CanConvertFrom(Type) |
傳回值,指出這個轉換子是否可將指定之型別的物件轉換為這個轉換子的型別。Returns whether this converter can convert an object of the given type to the type of this converter. (繼承來源 TypeConverter) |
CanConvertTo(ITypeDescriptorContext, Type) |
取得值,指出這個轉換子是否可以使用內容來將物件轉換成指定的目的型別。Returns a value indicating whether this converter can convert an object to the given destination type using the context. (繼承來源 ColorConverter) |
CanConvertTo(Type) |
傳回值,指出這個轉換子是否可以將物件轉換成指定的型別。Returns whether this converter can convert the object to the specified type. (繼承來源 TypeConverter) |
ConvertFrom(ITypeDescriptorContext, CultureInfo, Object) |
將指定值轉換成轉換子的型別。Converts the given value to the type of the converter. |
ConvertFrom(Object) |
會將指定值轉換為這個轉換子的型別。Converts the given value to the type of this converter. (繼承來源 TypeConverter) |
ConvertFromInvariantString(ITypeDescriptorContext, String) |
會使用不區分的文化特性和指定的內容,將指定的字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture and the specified context. (繼承來源 TypeConverter) |
ConvertFromInvariantString(String) |
會使用不因文化特性而異,將指定字串轉換為這個轉換子的型別。Converts the given string to the type of this converter, using the invariant culture. (繼承來源 TypeConverter) |
ConvertFromString(ITypeDescriptorContext, CultureInfo, String) |
會使用指定內容和文化特性資訊,將指定文字轉換為物件。Converts the given text to an object, using the specified context and culture information. (繼承來源 TypeConverter) |
ConvertFromString(ITypeDescriptorContext, String) |
會使用指定的內容,將指定文字轉換為物件。Converts the given text to an object, using the specified context. (繼承來源 TypeConverter) |
ConvertFromString(String) |
會將指定的文字轉換成物件。Converts the specified text to an object. (繼承來源 TypeConverter) |
ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type) |
將指定的物件轉換成指定的型別。Converts the specified object to a specified type. |
ConvertTo(Object, Type) |
會使用引數,將指定值物件轉換成指定型別。Converts the given value object to the specified type, using the arguments. (繼承來源 TypeConverter) |
ConvertToInvariantString(ITypeDescriptorContext, Object) |
會使用指定的內容,將指定值轉換成不因文化特性而異的字串表示。Converts the specified value to a culture-invariant string representation, using the specified context. (繼承來源 TypeConverter) |
ConvertToInvariantString(Object) |
會將指定值轉換成不因文化特性而異的字串表示。Converts the specified value to a culture-invariant string representation. (繼承來源 TypeConverter) |
ConvertToString(ITypeDescriptorContext, CultureInfo, Object) |
會使用指定的內容和文化特性資訊,將指定值轉換為字串表示。Converts the given value to a string representation, using the specified context and culture information. (繼承來源 TypeConverter) |
ConvertToString(ITypeDescriptorContext, Object) |
會使用指定的內容,將指定值轉換為字串表示。Converts the given value to a string representation, using the given context. (繼承來源 TypeConverter) |
ConvertToString(Object) |
會將指定值轉換成字串表示。Converts the specified value to a string representation. (繼承來源 TypeConverter) |
CreateInstance(IDictionary) |
重新建立 Object,需為物件提供一組屬性值。Re-creates an Object given a set of property values for the object. (繼承來源 TypeConverter) |
CreateInstance(ITypeDescriptorContext, IDictionary) |
使用指定的內容,建立與這個 TypeConverter 相關聯之類型的執行個體,並為物件提供一組屬性值。Creates an instance of the type that this TypeConverter is associated with, using the specified context, given a set of property values for the object. (繼承來源 TypeConverter) |
Equals(Object) |
判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object. (繼承來源 Object) |
GetConvertFromException(Object) |
傳回要在無法執行轉換時擲回的例外狀況。Returns an exception to throw when a conversion cannot be performed. (繼承來源 TypeConverter) |
GetConvertToException(Object, Type) |
傳回要在無法執行轉換時擲回的例外狀況。Returns an exception to throw when a conversion cannot be performed. (繼承來源 TypeConverter) |
GetCreateInstanceSupported() |
傳回值,指出在這個物件上變更值時是否需要呼叫 CreateInstance(IDictionary) 方法來建立新值。Returns whether changing a value on this object requires a call to the CreateInstance(IDictionary) method to create a new value. (繼承來源 TypeConverter) |
GetCreateInstanceSupported(ITypeDescriptorContext) |
傳回在這個物件上變更值是否需要呼叫 CreateInstance(IDictionary) 來建立新的值,並使用指定的內容。Returns whether changing a value on this object requires a call to CreateInstance(IDictionary) to create a new value, using the specified context. (繼承來源 TypeConverter) |
GetHashCode() |
做為預設雜湊函式。Serves as the default hash function. (繼承來源 Object) |
GetProperties(ITypeDescriptorContext, Object) |
會使用指定的內容,傳回由值參數所指定之陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context. (繼承來源 TypeConverter) |
GetProperties(ITypeDescriptorContext, Object, Attribute[]) |
使用指定的內容和屬性 (attribute),傳回由該值參數所指定之陣列類型的屬性 (property) 集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes. (繼承來源 TypeConverter) |
GetProperties(Object) |
傳回由值參數所指定的陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter. (繼承來源 TypeConverter) |
GetPropertiesSupported() |
傳回值,指出這個物件是否支援屬性。Returns whether this object supports properties. (繼承來源 TypeConverter) |
GetPropertiesSupported(ITypeDescriptorContext) |
使用指定的內容,傳回這個物件是否支援屬性。Returns whether this object supports properties, using the specified context. (繼承來源 TypeConverter) |
GetStandardValues() |
從為這個型別轉換子所設計的資料型別預設內容中,會傳回標準值的集合。Returns a collection of standard values from the default context for the data type this type converter is designed for. (繼承來源 TypeConverter) |
GetStandardValues(ITypeDescriptorContext) |
擷取集合,含有設計這個驗證程式之資料型別的標準值集。Retrieves a collection containing a set of standard values for the data type for which this validator is designed. 如果資料型別不支援標準值集,就會傳回 |
GetStandardValuesExclusive() |
傳回值,指出從 GetStandardValues() 所傳回的標準值集合是否為獨佔清單。Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list. (繼承來源 TypeConverter) |
GetStandardValuesExclusive(ITypeDescriptorContext) |
使用指定的內容,傳回從 GetStandardValues() 所傳回的標準值集合是否為可能值的獨占清單。Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list of possible values, using the specified context. (繼承來源 TypeConverter) |
GetStandardValuesSupported() |
傳回這個物件是否支援可以從清單中選取的標準值集合。Returns whether this object supports a standard set of values that can be picked from a list. (繼承來源 TypeConverter) |
GetStandardValuesSupported(ITypeDescriptorContext) |
判斷這個物件是否支援可以從清單選取的值標準集。Determines if this object supports a standard set of values that can be chosen from a list. (繼承來源 ColorConverter) |
GetType() |
取得目前執行個體的 Type。Gets the Type of the current instance. (繼承來源 Object) |
IsValid(ITypeDescriptorContext, Object) |
傳回指定值物件對這個類型和指定的內容是否有效。Returns whether the given value object is valid for this type and for the specified context. (繼承來源 TypeConverter) |
IsValid(Object) |
會傳回指定值物件是否對這個型別有效。Returns whether the given value object is valid for this type. (繼承來源 TypeConverter) |
MemberwiseClone() |
建立目前 Object 的淺層複製。Creates a shallow copy of the current Object. (繼承來源 Object) |
SortProperties(PropertyDescriptorCollection, String[]) |
排序屬性的集合。Sorts a collection of properties. (繼承來源 TypeConverter) |
ToString() |
傳回代表目前物件的字串。Returns a string that represents the current object. (繼承來源 Object) |