GraphicsPath.CloseAllFigures Metoda

Definicja

Zamyka wszystkie otwarte figury w tej ścieżce i uruchamia nowy rysunek. Zamyka każdy otwarty rysunek, łącząc linię z punktu końcowego z punktem początkowym.

C#
public void CloseAllFigures ();

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse, obiektu zdarzenia OnPaint. Kod wykonuje następujące akcje:

  • Tworzy ścieżkę.

  • Dodaje kilka otwartych ilustracji do ścieżki.

  • Zamyka wszystkie liczby w ścieżce.

  • Rysuje ścieżkę do ekranu.

C#
private void CloseAllFiguresExample(PaintEventArgs e)
{
             
    // Create a path containing several open-ended figures.
    GraphicsPath myPath = new GraphicsPath();
    myPath.StartFigure();
    myPath.AddLine(new Point(10, 10), new Point(150, 10));
    myPath.AddLine(new Point(150, 10), new Point(10, 150));
    myPath.StartFigure();
    myPath.AddArc(200, 200, 100, 100, 0, 90);
    myPath.StartFigure();
    Point point1 = new Point(300, 300);
    Point point2 = new Point(400, 325);
    Point point3 = new Point(400, 375);
    Point point4 = new Point(300, 400);
    Point[] points = {point1, point2, point3, point4};
    myPath.AddCurve(points);
             
    // Close all the figures.
    myPath.CloseAllFigures();
             
    // Draw the path to the screen.
    e.Graphics.DrawPath(new Pen(Color.Black, 3), myPath);
}

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