Size.Subtraction(Size, Size) Size.Subtraction(Size, Size) Size.Subtraction(Size, Size) Size.Subtraction(Size, Size) Operator

定義

將另一個 Size 結構的寬度和高度減去某一個 Size 結構的寬度和高度。Subtracts the width and height of one Size structure from 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

Size 結構,位於減法運算子的左側。The Size structure on the left side of the subtraction operator.

sz2
Size Size Size Size

Size 結構,位於減法運算子的右側。The Size structure on the right side of the subtraction operator.

傳回

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

範例

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

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

適用於