This documentation is archived and is not being maintained.

Size.op_Subtraction Method

Subtracts the width and height of one Size structure from the width and height of another Size structure.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

public static Size operator - (
	Size sz1,
	Size sz2
Not applicable.



The Size structure on the left side of the subtraction operator.


The Size structure on the right side of the subtraction operator.

Return Value

A Size structure that is the result of the subtraction operation.

The following code example demonstrates the op_Subtraction operator. The example is designed to be used with Windows Forms. To run the example, paste it into a form that contains a button named subtractionButton and associate the subtractButton_Click method with the button's Click event.

private void subtractButton_Click(System.Object sender, System.EventArgs e)
    subtractButton.Size = subtractButton.Size - new Size(10, 10);

private void subtractButton_Click(Object sender, System.EventArgs e)
        new Size(10, 10)));
} //subtractButton_Click

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, 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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0