Addition Operator

Size.Addition Operator (Size, Size)

 

Adds the width and height of one Size structure to 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
)

Parameters

sz1
Type: System.Drawing.Size

The first Size to add.

sz2
Type: System.Drawing.Size

The second Size to add.

Return Value

Type: System.Drawing.Size

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

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

private void addButton_Click(System.Object sender, System.EventArgs e)
{
    addButton.Size = addButton.Size + new Size(10, 10);
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft