GraphicsPath.CloseFigure 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 the current figure and starts a new figure. If the current figure contains a sequence of connected lines and curves, the method closes the loop by connecting a line from the endpoint to the starting point.
public:
void CloseFigure();
public void CloseFigure ();
member this.CloseFigure : unit -> unit
Public Sub CloseFigure ()
Examples
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, an OnPaint event object. The code creates a triangle by creating a new path, starting a figure, adding two intersecting lines to the figure, and then closing the figure to form a triangle. The path is then drawn to the screen.
private:
void CloseFigureExample( PaintEventArgs^ e )
{
// Create a path consisting of two, open-ended lines and close
// the lines using CloseFigure.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->StartFigure();
myPath->AddLine( Point(10,10), Point(200,10) );
myPath->AddLine( Point(200,10), Point(200,200) );
myPath->CloseFigure();
// Draw the path to the screen.
e->Graphics->DrawPath( Pens::Black, myPath );
}
private void CloseFigureExample(PaintEventArgs e)
{
// Create a path consisting of two, open-ended lines and close
// the lines using CloseFigure.
GraphicsPath myPath = new GraphicsPath();
myPath.StartFigure();
myPath.AddLine(new Point(10, 10), new Point(200, 10));
myPath.AddLine(new Point(200, 10), new Point(200, 200));
myPath.CloseFigure();
// Draw the path to the screen.
e.Graphics.DrawPath(Pens.Black, myPath);
}
Public Sub CloseFigureExample(ByVal e As PaintEventArgs)
' Create a path consisting of two, open-ended lines and close
' the lines using CloseFigure.
Dim myPath As New GraphicsPath
myPath.StartFigure()
myPath.AddLine(New Point(10, 10), New Point(200, 10))
myPath.AddLine(New Point(200, 10), New Point(200, 200))
myPath.CloseFigure()
' Draw the path to the screen.
e.Graphics.DrawPath(Pens.Black, myPath)
End Sub
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기