Color.IsNamedColor 属性


获取指示此 Color 结构是命名颜色还是 KnownColor 枚举成员的值。Gets a value indicating whether this Color structure is a named color or a member of the KnownColor enumeration.

 property bool IsNamedColor { bool get(); };
public bool IsNamedColor { get; }
member this.IsNamedColor : bool
Public ReadOnly Property IsNamedColor As Boolean


如果此 true 是使用 Color 方法或 FromName(String) 方法创建的,则为 FromKnownColor(KnownColor);否则为 falsetrue if this Color was created by using either the FromName(String) method or the FromKnownColor(KnownColor) method; otherwise, false.


此属性不比较 ARGB 值。This property does not do a comparison of the ARGB values. 因此,当 IsNamedColor 属性应用到使用 FromArgb 方法创建的 Color 结构时,IsNamedColor 返回 false,即使 ARGB 值与预定义颜色的 ARGB 值匹配。Therefore, when the IsNamedColor property is applied to a Color structure that is created by using the FromArgb method, IsNamedColor returns false, even if the ARGB value matches the ARGB value of a predefined color.