Color.Equals Color.Equals Color.Equals Color.Equals Method

定义

重载

Equals(Color) Equals(Color) Equals(Color) Equals(Color)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

测试指定的对象是否为 Color 结构并等效于此 Color 结构。Tests whether the specified object is a Color structure and is equivalent to this Color structure.

Equals(Color) Equals(Color) Equals(Color) Equals(Color)

public:
 virtual bool Equals(System::Drawing::Color other);
public bool Equals (System.Drawing.Color other);
override this.Equals : System.Drawing.Color -> bool
Public Function Equals (other As Color) As Boolean

参数

返回

实现

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

测试指定的对象是否为 Color 结构并等效于此 Color 结构。Tests whether the specified object is a Color structure and is equivalent to this Color structure.

public:
 override bool Equals(System::Object ^ obj);
public override bool Equals (object obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

参数

obj
Object Object Object Object

要测试的对象。The object to test.

返回

如果 obj 是等效于此 Color 结构的 Color 结构,为 true;否则为 falsetrue if obj is a Color structure equivalent to this Color structure; otherwise, false.

注解

此结构仅执行与其他比较Color结构。This structure only does comparisons with other Color structures. 若要比较基于其 ARGB 值的颜色,应使用ToArgb方法。To compare colors based solely on their ARGB values, you should use the ToArgb method. 这是因为EqualsEquality成员确定等效性时使用多个只是颜色的 ARGB 值。This is because the Equals and Equality members determine equivalency using more than just the ARGB value of the colors. 例如,BlackFromArgb(0,0,0)被视为不相等,因为Black是已命名的颜色和FromArgb(0,0,0)不是。For example, Black and FromArgb(0,0,0) are not considered equal, since Black is a named color and FromArgb(0,0,0) is not.

适用于