Color.Equals Method
Tests whether the specified object is a Color structure and is equivalent to this Color structure.
Overrides Public Function Equals( _
ByVal obj As Object _) As Boolean
[C#]
public override bool Equals(objectobj);
[C++]
public: bool Equals(Object* obj);
[JScript]
public override function Equals(
obj : Object) : Boolean;
Parameters
- obj
The object to test.
Return Value
This method returns true if obj is a Color structure equivalent to this Color structure; otherwise, false.
Remarks
This structure only does comparisons with other Color structures. To compare colors based solely on their ARGB values, you should do the following:
if ( color1.ToArgb() == color2.ToArgb()) ...
This is because the .Equals and == operators determine equivalency using more than just the ARGB value of the colors. For example, Color.Black and Color.FromArgb(0,0,0) are not considered equal since Color.Black is a named color and Color.FromArgb(0,0,0) is not.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
Color Structure | Color Members | System.Drawing Namespace