Graphics.DrawPath(Pen, GraphicsPath) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制 GraphicsPath。
public:
void DrawPath(System::Drawing::Pen ^ pen, System::Drawing::Drawing2D::GraphicsPath ^ path);
public void DrawPath (System.Drawing.Pen pen, System.Drawing.Drawing2D.GraphicsPath path);
member this.DrawPath : System.Drawing.Pen * System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub DrawPath (pen As Pen, path As GraphicsPath)
参数
- path
- GraphicsPath
要绘制的 GraphicsPath。
例外
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建图形路径对象并为其添加省略号。
创建黑色笔。
绘制屏幕的图形路径。
public:
void DrawPathEllipse( PaintEventArgs^ e )
{
// Create graphics path object and add ellipse.
GraphicsPath^ graphPath = gcnew GraphicsPath;
graphPath->AddEllipse( 0, 0, 200, 100 );
// Create pen.
Pen^ blackPen = gcnew Pen( Color::Black,3.0f );
// Draw graphics path to screen.
e->Graphics->DrawPath( blackPen, graphPath );
}
public void DrawPathEllipse(PaintEventArgs e)
{
// Create graphics path object and add ellipse.
GraphicsPath graphPath = new GraphicsPath();
graphPath.AddEllipse(0, 0, 200, 100);
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Draw graphics path to screen.
e.Graphics.DrawPath(blackPen, graphPath);
}
Public Sub DrawPathEllipse(ByVal e As PaintEventArgs)
' Create graphics path object and add ellipse.
Dim graphPath As New GraphicsPath
graphPath.AddEllipse(0, 0, 200, 100)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Draw graphics path to screen.
e.Graphics.DrawPath(blackPen, graphPath)
End Sub
注解
在绘制图形上下文之前,当前转换将应用于 GraphicsPath。