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 PointF GetLastPoint()

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.

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");
}

.NET Framework
Available since 1.1
Return to top
Show: