다음을 통해 공유


Point.Subtraction(Point, Size) 연산자

정의

지정된 Point의 음수가 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입니다.

sz
Size

pt 좌표에서 뺄 두 수를 지정하는 Size입니다.

반환

지정된 Point 구조체의 음수만큼 변환된 Size 구조체를 반환합니다.

예제

다음 코드 예제를 사용 PointConverter 하는 방법을 보여 줍니다는 및 연산자 Subtraction 입니다. 이 예제는 Windows Forms 함께 사용하도록 설계되었습니다. 이 코드를 양식에 붙여넣고 양식의 ShowPointConverterPaint 이벤트를 처리할 때 메서드를 호출하여 으로 PaintEventArgs전달합니다e.

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

적용 대상