Freigeben über


GraphicsPath.GetLastPoint-Methode

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

Namespace: System.Drawing.Drawing2D
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public Function GetLastPoint As PointF
'Usage
Dim instance As GraphicsPath
Dim returnValue As PointF

returnValue = instance.GetLastPoint
public PointF GetLastPoint ()
public:
PointF GetLastPoint ()
public PointF GetLastPoint ()
public function GetLastPoint () : PointF

Rückgabewert

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

Beispiel

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert das OnPaint-Ereignisobjekt PaintEventArgse. Der Code erstellt einen Pfad, fügt diesem eine Linie hinzu und ruft dann den letzten Punkt im Pfad ab.

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
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");
}
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.get_IsEmpty() == false) {
        String lastPointXString = System.Convert.ToString(
                                lastPoint.get_X());
        String lastPointYString = System.Convert.ToString(
                                lastPoint.get_Y());

        MessageBox.Show((lastPointXString + ", " + lastPointYString));
    }
    else {
        MessageBox.Show("lastPoint is empty");
    }
} //GetLastPointExample

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

GraphicsPath-Klasse
GraphicsPath-Member
System.Drawing.Drawing2D-Namespace