Export (0) Print
Expand All

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 ()
public PointF GetLastPoint ()
public function GetLastPoint () : PointF
Not applicable.

Return Value

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

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

Windows 98, Windows Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft