Size.Addition(Size, Size) Size.Addition(Size, Size) Size.Addition(Size, Size) Size.Addition(Size, Size) Operator

定義

將一個 Size 結構的寬度和高度加上另一個 Size 結構的寬度和高度。Adds the width and height of one Size structure to the width and height of another Size structure.

public:
 static System::Drawing::Size operator +(System::Drawing::Size sz1, System::Drawing::Size sz2);
public static System.Drawing.Size operator + (System.Drawing.Size sz1, System.Drawing.Size sz2);
static member ( + ) : System.Drawing.Size * System.Drawing.Size -> System.Drawing.Size
Public Shared Operator + (sz1 As Size, sz2 As Size) As Size

參數

sz1
Size Size Size Size

要相加的第一個 SizeThe first Size to add.

sz2
Size Size Size Size

要相加的第二個 SizeThe second Size to add.

傳回

Size 結構,即加法運算的結果。A Size structure that is the result of the addition operation.

範例

下列程式碼範例示範Addition運算子。The following code example demonstrates the Addition operator. 此範例的設計目的是要與 Windows Forms 搭配使用。The example is designed to be used with Windows Forms. 若要執行此範例, 請將它貼入包含名為addButton之按鈕的表單中, 並addButton_Click將方法Click與按鈕的事件產生關聯。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.

void addButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   addButton->Size = addButton->Size + System::Drawing::Size( 10, 10 );
}
private void addButton_Click(System.Object sender, System.EventArgs e)
{
    addButton.Size = addButton.Size + new Size(10, 10);
}
Private Sub addButton_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles addButton.Click
    addButton.Size = Size.op_Addition(addButton.Size, New Size(10, 10))
End Sub

適用於