GraphicsPath.GetLastPoint Method ()


Gets the last point in the PathPoints array of this GraphicsPath.

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

Public Function GetLastPoint As PointF

Return Value

Type: System.Drawing.PointF

A PointF that represents the last point in this GraphicsPath.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. The code creates a path, adds a line to the path, and then gets the last point in the path.

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))
        MessageBox.Show("lastPoint is empty")
    End If
End Sub

.NET Framework
Available since 1.1
Return to top