Color.Inequality(Color, Color) 연산자
정의
public:
static bool operator !=(System::Drawing::Color left, System::Drawing::Color right);
public static bool operator != (System.Drawing.Color left, System.Drawing.Color right);
static member op_Inequality : System.Drawing.Color * System.Drawing.Color -> bool
Public Shared Operator != (left As Color, right As Color) As Boolean
매개 변수
반환
두 Color 구조체가 다르면 true
이고, 그렇지 않으면 false
입니다.true
if the two Color structures are different; otherwise, false
.
예제
다음 코드 예제에서는 Inequality 연산자와 클래스를 보여 줍니다 SystemColors .The following code example demonstrates the Inequality operator and the SystemColors class. 이 예제는 이라는 단추를 포함 하는 Windows Form에서 사용 하도록 설계 되었습니다 Button2
.This example is designed to be used with a Windows Form that contains a button named Button2
. 폼에 다음 코드를 붙여넣고 Button2_Click
메서드를 단추의 이벤트와 연결 Click 합니다.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.BackColor != SystemColors.ControlDark)
{
this.BackColor = SystemColors.ControlDark;
}
if (!(this.Font.Bold))
{
this.Font = new Font(this.Font, FontStyle.Bold);
}
}
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
If (Color.op_Inequality(Me.BackColor, SystemColors.ControlDark)) Then
Me.BackColor = SystemColors.ControlDark
End If
If Not (Me.Font.Bold) Then
Me.Font = New Font(Me.Font, FontStyle.Bold)
End If
End Sub
설명
이 메서드는 구조체의 ARGB 값 보다 많은 값을 비교 Color 합니다.This method compares more than the ARGB values of the Color structures. 또한 일부 상태 플래그를 비교 합니다.It also does a comparison of some state flags. 두 구조체의 ARGB 값만 비교 하려면 Color 메서드를 사용 ToArgb 합니다.If you want to compare just the ARGB values of two Color structures, use the ToArgb method.