Point.Subtraction(Point, Size) 연산자

정의

지정된 Point의 음수가 Size를 변환합니다.Translates a Point by the negative of a given Size.

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

매개 변수

pt
Point

변환할 Point입니다.The Point to translate.

sz
Size

pt 좌표에서 뺄 두 수를 지정하는 Size입니다.A Size that specifies the pair of numbers to subtract from the coordinates of pt.

반환

Point

지정된 Point 구조체의 음수만큼 변환된 Size 구조체를 반환합니다.A Point structure that is translated by the negative of a given Size structure.

예제

다음 코드 예제에서는 및 연산자를 사용 하는 방법을 보여 줍니다 PointConverter Subtraction .The following code example demonstrates how to use the PointConverter and the Subtraction operator. 이 예제는 Windows Forms와 함께 사용 하도록 설계 되었습니다.This example is designed to be used with Windows Forms. 폼에이 코드 ShowPointConverter 를 붙여넣고 폼의 이벤트를 처리할 때 메서드를 호출 Paint 하 여를 e 로 전달 PaintEventArgs 합니다.Paste this code into a form and call the ShowPointConverter method when handling the form's Paint event, passing e as PaintEventArgs.

void ShowPointConverter( PaintEventArgs^ e )
{
   // Create the PointConverter.
   System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( Point::typeid );
   Point point1 =  *dynamic_cast<Point^>(converter->ConvertFromString( "200, 200" ));

   // Use the subtraction operator to get a second point.
   Point point2 = point1 - System::Drawing::Size( 190, 190 );

   // Draw a line between the two points.
   e->Graphics->DrawLine( Pens::Black, point1, point2 );
}
private void ShowPointConverter(PaintEventArgs e)
{

    // Create the PointConverter.
    System.ComponentModel.TypeConverter converter = 
        System.ComponentModel.TypeDescriptor.GetConverter(typeof(Point));

    Point point1 = (Point) converter.ConvertFromString("200, 200");

    // Use the subtraction operator to get a second point.
    Point point2 = point1 - new Size(190, 190);

    // Draw a line between the two points.
    e.Graphics.DrawLine(Pens.Black, point1, point2);
}
Private Sub ShowPointConverter(ByVal e As PaintEventArgs)

    ' Create the PointConverter.
    Dim converter As System.ComponentModel.TypeConverter = _
        System.ComponentModel.TypeDescriptor.GetConverter(GetType(Point))

    Dim point1 As Point = _
        CType(converter.ConvertFromString("200, 200"), Point)

    ' Use the subtraction operator to get a second point.
    Dim point2 As Point = Point.op_Subtraction(point1, _
        New Size(190, 190))

    ' Draw a line between the two points.
    e.Graphics.DrawLine(Pens.Black, point1, point2)
End Sub

적용 대상