GraphicsPath.Widen 方法

定義

將這個路徑取代為封閉在指定的筆觸繪製這個路徑時所填滿之區域的曲線。

多載

Widen(Pen, Matrix)

將額外的外框加入至 GraphicsPath

Widen(Pen)

將額外的外框加入至路徑。

Widen(Pen, Matrix, Single)

將這個 GraphicsPath 取代為封閉在指定的畫筆繪製這個路徑時所填滿之區域的曲線。

Widen(Pen, Matrix)

來源:
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

將額外的外框加入至路徑。

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 取代為封閉在指定的畫筆繪製這個路徑時所填滿之區域的曲線。

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 使用,而且需要 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

適用於