共用方式為


GraphicsPath.Widen 方法

定義

以曲線取代此路徑,此曲線會括住指定手寫筆繪製此路徑時填滿的區域。

多載

Widen(Pen, Matrix)

將額外的外框新增至 GraphicsPath

Widen(Pen)

將其他大綱新增至路徑。

Widen(Pen, Matrix, Single)

以曲線取代此 GraphicsPath,此曲線會括住指定的畫筆繪製此路徑時填滿的區域。

Widen(Pen, Matrix)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
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)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
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)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
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 Forms 搭配使用,而且需要 PaintEventArgseOnPaint 事件物件。 程式代碼會執行下列動作:

  • 建立路徑,並將兩個省略號新增至路徑。

  • 以黑色繪製路徑。

  • 擴大路徑。

  • 以紅色繪製路徑。

請注意,第二個轉譯使用 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

適用於