GraphicsPath.Widen 方法

定义

在用指定的钢笔绘制此路径时,用包含所填充区域的曲线代替此路径。

重载

Widen(Pen, Matrix)

向该 GraphicsPath 添加附加轮廓。

Widen(Pen)

向该路径添加附加轮廓。

Widen(Pen, Matrix, Single)

在用指定的钢笔绘制此路径时,用包含所填充区域的曲线代替此 GraphicsPath

Widen(Pen, Matrix)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

向该 GraphicsPath 添加附加轮廓。

public:
 void Widen(System::Drawing::Pen ^ pen, System::Drawing::Drawing2D::Matrix ^ matrix);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix matrix);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix? matrix);
member this.Widen : System.Drawing.Pen * System.Drawing.Drawing2D.Matrix -> unit
Public Sub Widen (pen As Pen, matrix As Matrix)

参数

pen
Pen

一个 Pen,指定路径原始轮廓和此方法创建的新轮廓之间的宽度。

matrix
Matrix

一个 Matrix,指定扩展前应用于路径的变换。

示例

有关示例,请参见 Widen(Pen, Matrix, Single)

注解

此方法在此 GraphicsPath中的原始行周围创建一个轮廓,现有线条与新轮廓之间的距离等于调用 Widen中使用的 的Pen宽度的距离。 如果要填充行之间的空格, FillPath 则必须使用 而不是 DrawPath

适用于

Widen(Pen)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

向该路径添加附加轮廓。

public:
 void Widen(System::Drawing::Pen ^ pen);
public void Widen (System.Drawing.Pen pen);
member this.Widen : System.Drawing.Pen -> unit
Public Sub Widen (pen As Pen)

参数

pen
Pen

一个 Pen,指定路径原始轮廓和此方法创建的新轮廓之间的宽度。

示例

有关示例,请参见 Widen(Pen, Matrix, Single)

注解

此方法在此 GraphicsPath中的原始行周围创建一个轮廓,现有线条与新轮廓之间的距离等于调用 Widen中使用的 的Pen宽度的距离。 如果要填充行之间的空格, FillPath 则必须使用 而不是 DrawPath

适用于

Widen(Pen, Matrix, Single)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

在用指定的钢笔绘制此路径时,用包含所填充区域的曲线代替此 GraphicsPath

public:
 void Widen(System::Drawing::Pen ^ pen, System::Drawing::Drawing2D::Matrix ^ matrix, float flatness);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix matrix, float flatness);
public void Widen (System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix? matrix, float flatness);
member this.Widen : System.Drawing.Pen * System.Drawing.Drawing2D.Matrix * single -> unit
Public Sub Widen (pen As Pen, matrix As Matrix, flatness As Single)

参数

pen
Pen

一个 Pen,指定路径原始轮廓和此方法创建的新轮廓之间的宽度。

matrix
Matrix

一个 Matrix,指定扩展前应用于路径的变换。

flatness
Single

指定曲线展平的值。

示例

下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse事件OnPaint对象。 此代码执行以下操作:

  • 创建一个路径,并向该路径添加两个省略号。

  • 以黑色绘制路径。

  • 扩大路径。

  • 以红色绘制路径。

请注意,第二个呈现使用 FillPath 而不是 DrawPath,因此呈现的图形填充了轮廓。

private:
   void WidenExample( PaintEventArgs^ e )
   {
      // Create a path and add two ellipses.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddEllipse( 0, 0, 100, 100 );
      myPath->AddEllipse( 100, 0, 100, 100 );

      // Draw the original ellipses to the screen in black.
      e->Graphics->DrawPath( Pens::Black, myPath );

      // Widen the path.
      Pen^ widenPen = gcnew Pen( Color::Black,10.0f );
      Matrix^ widenMatrix = gcnew Matrix;
      widenMatrix->Translate( 50, 50 );
      myPath->Widen( widenPen, widenMatrix, 1.0f );

      // Draw the widened path to the screen in red.
      e->Graphics->FillPath( gcnew SolidBrush( Color::Red ), myPath );
   }
private void WidenExample(PaintEventArgs e)
{
             
    // Create a path and add two ellipses.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddEllipse(0, 0, 100, 100);
    myPath.AddEllipse(100, 0, 100, 100);
             
    // Draw the original ellipses to the screen in black.
    e.Graphics.DrawPath(Pens.Black, myPath);
             
    // Widen the path.
    Pen widenPen = new Pen(Color.Black, 10);
    Matrix widenMatrix = new Matrix();
    widenMatrix.Translate(50, 50);
    myPath.Widen(widenPen, widenMatrix, 1.0f);
             
    // Draw the widened path to the screen in red.
    e.Graphics.FillPath(new SolidBrush(Color.Red), myPath);
}
Public Sub WidenExample(ByVal e As PaintEventArgs)
    Dim myPath As New GraphicsPath
    myPath.AddEllipse(0, 0, 100, 100)
    myPath.AddEllipse(100, 0, 100, 100)
    e.Graphics.DrawPath(Pens.Black, myPath)
    Dim widenPen As New Pen(Color.Black, 10)
    Dim widenMatrix As New Matrix
    widenMatrix.Translate(50, 50)
    myPath.Widen(widenPen, widenMatrix, 1.0F)
    ' Sets tension for curves.
    e.Graphics.FillPath(New SolidBrush(Color.Red), myPath)
End Sub

注解

此方法在此 GraphicsPath中的原始行周围创建一个轮廓,现有线条与新轮廓之间的距离等于调用 Widen中使用的 的Pen宽度的距离。 如果要填充行之间的空格, FillPath 则必须使用 而不是 DrawPath

适用于