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

Definition

Verschiebt einen Point um den negativen Wert einer angegebenen 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

Parameter

pt
Point Point Point Point

Der zu verschiebende Point.The Point to translate.

sz
Size Size Size Size

Eine Size, die das von den Koordinaten von pt zu subtrahierende Zahlenpaar angibt.A Size that specifies the pair of numbers to subtract from the coordinates of pt.

Gibt zurück

Eine Point-Struktur, die um den negativen Wert einer angegebenen Size-Struktur verschoben wird.A Point structure that is translated by the negative of a given Size structure.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie der PointConverter -Operator Subtraction und der-Operator verwendet werden.The following code example demonstrates how to use the PointConverter and the Subtraction operator. Dieses Beispiel ist für die Verwendung mit Windows Forms konzipiert.This example is designed to be used with Windows Forms. Fügen Sie diesen Code in ein Formular ein, ShowPointConverter und nennen Sie die-Methode Paint , wenn Sie das PaintEventArgs-Ereignis des Formulars behandeln, indem e Sie alsPaste 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

Gilt für: