PointF.Subtraction 运算符

定义

按指定大小的负值平移 PointFTranslates a PointF by the negative of a specified size.

重载

Subtraction(PointF, Size)

PointF 平移给定 Size 的负数。Translates a PointF by the negative of a given Size.

Subtraction(PointF, SizeF)

按指定 PointF 的负值平移 SizeFTranslates a PointF by the negative of a specified SizeF.

Subtraction(PointF, Size)

PointF 平移给定 Size 的负数。Translates a PointF by the negative of a given Size.

public:
 static System::Drawing::PointF operator -(System::Drawing::PointF pt, System::Drawing::Size sz);
public static System.Drawing.PointF operator - (System.Drawing.PointF pt, System.Drawing.Size sz);
static member ( - ) : System.Drawing.PointF * System.Drawing.Size -> System.Drawing.PointF
Public Shared Operator - (pt As PointF, sz As Size) As PointF

参数

pt
PointF

要平移的 PointFThe PointF to translate.

sz
Size

Size,它指定要从 pt 的坐标中减去的数。The Size that specifies the numbers to subtract from the coordinates of pt.

返回

转换的 PointFThe translated PointF.

Subtraction(PointF, SizeF)

按指定 PointF 的负值平移 SizeFTranslates a PointF by the negative of a specified SizeF.

public:
 static System::Drawing::PointF operator -(System::Drawing::PointF pt, System::Drawing::SizeF sz);
public static System.Drawing.PointF operator - (System.Drawing.PointF pt, System.Drawing.SizeF sz);
static member ( - ) : System.Drawing.PointF * System.Drawing.SizeF -> System.Drawing.PointF
Public Shared Operator - (pt As PointF, sz As SizeF) As PointF

参数

pt
PointF

要平移的 PointFThe PointF to translate.

sz
SizeF

SizeF,它指定要从 pt 的坐标中减去的数。The SizeF that specifies the numbers to subtract from the coordinates of pt.

返回

转换的 PointFThe translated PointF.

示例

下面的代码示例演示如何使用 Subtraction 运算符。The following code example demonstrates how to use the Subtraction operator. 若要运行此示例,请将以下代码粘贴到 Windows 窗体中。To run this example, paste the following code into a Windows Form. 处理窗体的 Paint 事件并调用 opSubtractionExample,将 e 作为 PaintEventArgs传递。Handle the form's Paint event and call opSubtractionExample, passing e as PaintEventArgs.

private void OpSubtractionExample(PaintEventArgs e)
{
    PointF point1 = new PointF(120.5F, 120F);
    SizeF size1 = new SizeF(20.5F, 20.5F);
    PointF point2 = point1 - size1;
    e.Graphics.DrawLine(Pens.Blue, point1, point2);
}
Private Sub OpSubtractionExample(ByVal e As PaintEventArgs) 
    Dim point1 As New PointF(120.5F, 120F)
    Dim size1 As New SizeF(120.5F, 30.5F)
    Dim point2 As PointF = point1 - size1
    e.Graphics.DrawLine(Pens.Blue, point1, point2)

End Sub

注解

Subtraction 运算符从 PointF 的 x 坐标中减去指定大小的 Width,从 PointF的 y 坐标中减去 HeightThe Subtraction operator subtracts the Width of the specified size from the x-coordinate of the PointF and the Height from the y-coordinate of the PointF.

此运算符的等效方法是 PointF.Subtract(PointF, SizeF)The equivalent method for this operator is PointF.Subtract(PointF, SizeF)

适用于