Point.Subtraction(Point, Size) Opérateur

Définition

Traduit un Point par le négatif d’un donné 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

Paramètres

pt
Point

À Point traduire.

sz
Size

Qui Size spécifie la paire de nombres à soustraire des coordonnées de pt.

Retours

Structure Point traduite par le négatif d’une structure donnée Size .

Exemples

L’exemple de code suivant montre comment utiliser l’opérateur PointConverter et l’opérateur Subtraction . Cet exemple est conçu pour être utilisé avec Windows Forms. Collez ce code dans un formulaire et appelez la méthode lors de la ShowPointConverter gestion de l’événement du Paint formulaire, en passant e en tant que 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

S’applique à