GraphicsPath.GetLastPoint Methode

Definition

Ruft den letzten Punkt im PathPoints-Array dieses GraphicsPath ab.

public:
 System::Drawing::PointF GetLastPoint();
public System.Drawing.PointF GetLastPoint ();
member this.GetLastPoint : unit -> System.Drawing.PointF
Public Function GetLastPoint () As PointF

Gibt zurück

Eine PointF-Struktur, die den letzten Punkt in diesem GraphicsPath darstellt.

Beispiele

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse, ein OnPaint Ereignisobjekt. Der Code erstellt einen Pfad, fügt dem Pfad eine Zeile hinzu und ruft dann den letzten Punkt im Pfad ab.

private:
   void GetLastPointExample( PaintEventArgs^ /*e*/ )
   {
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddLine( 20, 20, 100, 20 );
      PointF lastPoint = myPath->GetLastPoint();
      if ( lastPoint.IsEmpty == false )
      {
         String^ lastPointXString = lastPoint.X.ToString();
         String^ lastPointYString = lastPoint.Y.ToString();
         MessageBox::Show( String::Concat( lastPointXString, ", ", lastPointYString ) );
      }
      else
            MessageBox::Show( "lastPoint is empty" );
   }
private void GetLastPointExample(PaintEventArgs e)
{
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddLine(20, 20, 100, 20);
    PointF lastPoint = myPath.GetLastPoint();
    if(lastPoint.IsEmpty == false)
    {
        string lastPointXString = lastPoint.X.ToString();
        string lastPointYString = lastPoint.Y.ToString();
        MessageBox.Show(lastPointXString + ", " + lastPointYString);
    }
    else
    {
        MessageBox.Show("lastPoint is empty");
    }
}
Public Sub GetLastPointExample(ByVal e As PaintEventArgs)
    Dim myPath As New GraphicsPath
    myPath.AddLine(20, 20, 100, 20)
    Dim lastPoint As PointF = myPath.GetLastPoint()
    If lastPoint.IsEmpty = False Then
        Dim lastPointXString As String = lastPoint.X.ToString()
        Dim lastPointYString As String = lastPoint.Y.ToString()
        MessageBox.Show((lastPointXString + ", " + lastPointYString))
    Else
        MessageBox.Show("lastPoint is empty")
    End If
End Sub

Gilt für: