Color.op_Inequality Method
Assembly: System.Drawing (in system.drawing.dll)
Not applicable.
Parameters
- left
The Color that is to the left of the inequality operator.
- right
The Color that is to the right of the inequality operator.
Return Value
true if the two Color structures are different; 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, use the ToArgb method.
The following code example demonstrates the op_Inequality operator and the SystemColors class. This example is designed to be used with a Windows Form that contains a button named Button2. Paste the following code into your form and associate the Button2_Click method with the button's Click event.
void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) { if ( this->BackColor != SystemColors::ControlDark ) { this->BackColor = SystemColors::ControlDark; } if ( !(this->Font->Bold) ) { this->Font = gcnew System::Drawing::Font( this->Font,FontStyle::Bold ); } }
private void button2_Click(System.Object sender, System.EventArgs e)
{
if (!(this.get_BackColor().Equals(SystemColors.get_ControlDark()))) {
this.set_BackColor(SystemColors.get_ControlDark());
}
if (!(this.get_Font().get_Bold())) {
this.set_Font(new Font(this.get_Font(), FontStyle.Bold));
}
} //button2_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.