GraphicsPath.CloseFigure 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
闭合当前图形并开始新的图形。 如果当前图形包含一系列相互连接的直线和曲线,该方法通过连接一条从终结点到起始点的直线,闭合该环回。
public:
void CloseFigure();
public void CloseFigure ();
member this.CloseFigure : unit -> unit
Public Sub CloseFigure ()
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
事件OnPaint对象。 该代码通过创建新路径、开始图形、向图形添加两条相交线,然后关闭图形以形成三角形来创建三角形。 然后,该路径将绘制到屏幕。
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
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈