DrawingAttributes.Equality Operator (DrawingAttributes, DrawingAttributes)

 
equivalentCodeEntityM:System.Windows.Ink.DrawingAttributes.Equals(System.Windows.Ink.DrawingAttributes,System.Windows.Ink.DrawingAttributes)

Determines whether the specified DrawingAttributes objects are equal.

Namespace:   System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public static bool operator ==(
	DrawingAttributes first,
	DrawingAttributes second
)

Parameters

first
Type: System.Windows.Ink.DrawingAttributes

The first DrawingAttributes object to compare.

second
Type: System.Windows.Ink.DrawingAttributes

The second DrawingAttributes object to compare.

Return Value

Type: System.Boolean

true if the objects are equal; otherwise, false.

Two DrawingAttributes objects are equal if the following properties are equal:

System_CAPS_noteNote

The Equality method does not check the custom properties for equality.

The following example compares two DrawingAttributes objects for equality. Because the Color, StylusTip, Height, and Width properties on attributes1 and attributes2 are set to the same values, the "The DrawingAttributes are equal" message appears.

DrawingAttributes attributes1 = new DrawingAttributes();
attributes1.Color = Colors.Blue;
attributes1.StylusTip = StylusTip.Rectangle;
attributes1.Height = 5;
attributes1.Width = 5;

DrawingAttributes attributes2 = new DrawingAttributes();
attributes2.Color = Colors.Blue;
attributes2.StylusTip = StylusTip.Rectangle;
attributes2.Height = 5;
attributes2.Width = 5;
if (attributes1 == attributes2)
{
    MessageBox.Show("The DrawingAttributes are equal");
}
else
{
    MessageBox.Show("The DrawingAttributes are not equal");
}

.NET Framework
Available since 3.0
Return to top
Show: