GraphicsPath.CloseAllFigures Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Closes all open figures in this path and starts a new figure. It closes each open figure by connecting a line from its endpoint to its starting point.
public:
void CloseAllFigures();
public void CloseAllFigures ();
member this.CloseAllFigures : unit -> unit
Public Sub CloseAllFigures ()
Examples
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, an OnPaint event object. The code performs the following actions:
Creates a path.
Adds several open figures to the path.
Closes all figures in the path.
Draws the path to the screen.
private:
void CloseAllFiguresExample( PaintEventArgs^ e )
{
// Create a path containing several open-ended figures.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->StartFigure();
myPath->AddLine( Point(10,10), Point(150,10) );
myPath->AddLine( Point(150,10), Point(10,150) );
myPath->StartFigure();
myPath->AddArc( 200, 200, 100, 100, 0, 90 );
myPath->StartFigure();
Point point1 = Point(300,300);
Point point2 = Point(400,325);
Point point3 = Point(400,375);
Point point4 = Point(300,400);
array<Point>^ points = {point1,point2,point3,point4};
myPath->AddCurve( points );
// Close all the figures.
myPath->CloseAllFigures();
// Draw the path to the screen.
e->Graphics->DrawPath( gcnew Pen( Color::Black,3.0f ), myPath );
}
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);
}
Public Sub CloseAllFiguresExample(ByVal e As PaintEventArgs)
' Create a path containing several open-ended figures.
Dim myPath As 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()
Dim point1 As New Point(300, 300)
Dim point2 As New Point(400, 325)
Dim point3 As New Point(400, 375)
Dim point4 As New Point(300, 400)
Dim points As Point() = {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)
End Sub
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기