Color.op_Equality Method
Assembly: System.Drawing (in system.drawing.dll)
Not applicable.
Parameters
- left
The Color that is to the left of the equality operator.
- right
The Color that is to the right of the equality operator.
Return Value
true if the two Color structures are equal; otherwise, false.This method compares more than the ARGB values of the Color structures. It also does a comparison of some state flags. If you want to compare just the ARGB values of two Color structures, compare them using the ToArgb method.
The following code example demonstrates the op_Equality operator and the SystemColors class. This example is designed to be used with a Windows Form that contains a button named Button1. Paste the following code into your form and associate the Button1_Click method with the button's Click event.
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) { if ( this->BackColor == SystemColors::ControlDark ) { this->BackColor = SystemColors::Control; } }
private void button1_Click(System.Object sender, System.EventArgs e)
{
if (this.get_BackColor().Equals(SystemColors.get_ControlDark())) {
this.set_BackColor(SystemColors.get_Control());
}
} //button1_Click
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.