GraphicsPath.GetLastPoint Metoda

Definicja

Pobiera ostatni punkt w tablicy PathPoints tego GraphicsPath.

C#
public System.Drawing.PointF GetLastPoint ();

Zwraca

PointF, który reprezentuje ostatni punkt w tym GraphicsPath.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse, obiektu zdarzenia OnPaint. Kod tworzy ścieżkę, dodaje wiersz do ścieżki, a następnie pobiera ostatni punkt w ścieżce.

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

Dotyczy

Produkt Wersje
.NET 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9