Size.Subtraction(Size, Size) 运算符

定义

用另一个 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 结构。The Size structure on the left side of the subtraction operator.

sz2
Size

减法运算符右侧的 Size 结构。The Size structure on the right side of the subtraction operator.

返回

Size

一个 Size 结构,它是该减法运算的结果。A Size structure that is the result of the subtraction operation.

示例

下面的代码示例演示 Subtraction 运算符。The following code example demonstrates the Subtraction operator. 该示例旨在与 Windows 窗体一起使用。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

适用于