Graphics.SetClip メソッド

定義

この Graphics のクリッピング領域を指定した GraphicsClip プロパティに設定します。

オーバーロード

SetClip(Region, CombineMode)

この Graphics のクリッピング領域を、現在のクリップ領域と指定した Region とを組み合わせる指定の操作の結果に設定します。

SetClip(RectangleF, CombineMode)

この Graphics のクリッピング領域を現在のクリップ領域と RectangleF 構造体で指定された四角形とを組み合わせる指定の操作の結果に設定します。

SetClip(Rectangle, CombineMode)

この Graphics のクリッピング領域を現在のクリップ領域と Rectangle 構造体で指定された四角形とを組み合わせる指定の操作の結果に設定します。

SetClip(Graphics, CombineMode)

この Graphics のクリッピング領域を、現在のクリップ領域と指定した GraphicsClip プロパティとを組み合わせる指定の操作の結果に設定します。

SetClip(RectangleF)

この Graphics のクリッピング領域を RectangleF 構造体で指定された四角形に設定します。

SetClip(Rectangle)

この Graphics のクリッピング領域を Rectangle 構造体で指定された四角形に設定します。

SetClip(Graphics)

この Graphics のクリッピング領域を指定した GraphicsClip プロパティに設定します。

SetClip(GraphicsPath)

この Graphics のクリッピング領域を指定した GraphicsPath オブジェクトに設定します。

SetClip(GraphicsPath, CombineMode)

この Graphics のクリッピング領域を、現在のクリップ領域と指定した GraphicsPath とを組み合わせる指定の操作の結果に設定します。

SetClip(Region, CombineMode)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を、現在のクリップ領域と指定した Region とを組み合わせる指定の操作の結果に設定します。

public:
 void SetClip(System::Drawing::Region ^ region, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Region region, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Region * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (region As Region, combineMode As CombineMode)

パラメーター

region
Region

組み合わせる Region

combineMode
CombineMode

使用する組み合わせ操作を指定する CombineMode 列挙体のメンバー。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • クリッピング領域の小さな四角形を作成します。

  • メンバーを含む四角形にクリッピング領域を Replace 設定します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、塗りつぶされた小さな黒い四角形になります。

public:
   void SetClipRegionCombine( PaintEventArgs^ e )
   {
      // Create region for clipping.
      System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(0,0,100,100) );

      // Set clipping region of graphics to region.
      e->Graphics->SetClip( clipRegion, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRegionCombine(PaintEventArgs e)
{

    // Create region for clipping.
    Region clipRegion = new Region(new Rectangle(0, 0, 100, 100));

    // Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRegionCombine(ByVal e As PaintEventArgs)

    ' Create region for clipping.
    Dim clipRegion As New [Region](New Rectangle(0, 0, 100, 100))

    ' Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

適用対象

SetClip(RectangleF, CombineMode)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を現在のクリップ領域と RectangleF 構造体で指定された四角形とを組み合わせる指定の操作の結果に設定します。

public:
 void SetClip(System::Drawing::RectangleF rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.RectangleF rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.RectangleF * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As RectangleF, combineMode As CombineMode)

パラメーター

rect
RectangleF

組み合わせる RectangleF 構造体。

combineMode
CombineMode

使用する組み合わせ操作を指定する CombineMode 列挙体のメンバー。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • クリッピング領域の小さな四角形を作成します。

  • メンバーを含む四角形にクリッピング領域を Replace 設定します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、塗りつぶされた小さな黒い四角形になります。

public:
   void SetClipRectangleFCombine( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleFCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleFCombine(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

適用対象

SetClip(Rectangle, CombineMode)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を現在のクリップ領域と Rectangle 構造体で指定された四角形とを組み合わせる指定の操作の結果に設定します。

public:
 void SetClip(System::Drawing::Rectangle rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Rectangle rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Rectangle * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As Rectangle, combineMode As CombineMode)

パラメーター

rect
Rectangle

組み合わせる Rectangle 構造体。

combineMode
CombineMode

使用する組み合わせ操作を指定する CombineMode 列挙体のメンバー。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • クリッピング領域の小さな四角形を作成します。

  • メンバーを含む四角形にクリッピング領域を Replace 設定します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、塗りつぶされた小さな黒い四角形になります。

public:
   void SetClipRectangleCombine( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      Rectangle clipRect = Rectangle(0,0,100,100);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleCombine(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New Rectangle(0, 0, 100, 100)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

適用対象

SetClip(Graphics, CombineMode)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を、現在のクリップ領域と指定した GraphicsClip プロパティとを組み合わせる指定の操作の結果に設定します。

public:
 void SetClip(System::Drawing::Graphics ^ g, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Graphics g, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Graphics * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (g As Graphics, combineMode As CombineMode)

パラメーター

g
Graphics

組み合わせるクリップ領域を指定する Graphics

combineMode
CombineMode

使用する組み合わせ操作を指定する CombineMode 列挙体のメンバー。

次のコード例は、Windows フォームで使用するように設計されており、この例では イベント ハンドラーthisFormFormPaint パラメーターである と、 が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • 例の からthisFormForm一時的Graphicsな を作成します。

  • 一時 Graphics のクリッピング領域を小さな四角形に設定します。

  • フォームのグラフィック オブジェクトのクリッピング領域を、 メンバーと共に新しい Graphics の領域にReplace更新します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、小さく塗りつぶされた黒い四角形になります。

public:
   void SetClipGraphicsCombine( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphicsCombine(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphicsCombine(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

適用対象

SetClip(RectangleF)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を RectangleF 構造体で指定された四角形に設定します。

public:
 void SetClip(System::Drawing::RectangleF rect);
public void SetClip (System.Drawing.RectangleF rect);
member this.SetClip : System.Drawing.RectangleF -> unit
Public Sub SetClip (rect As RectangleF)

パラメーター

rect
RectangleF

新しいクリップ領域を表す RectangleF 構造体。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • クリッピング領域の小さな四角形を作成します。

  • クリッピング領域を四角形に設定します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、塗りつぶされた小さな黒い四角形になります。

public:
   void SetClipRectangleF( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleF(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleF(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

適用対象

SetClip(Rectangle)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を Rectangle 構造体で指定された四角形に設定します。

public:
 void SetClip(System::Drawing::Rectangle rect);
public void SetClip (System.Drawing.Rectangle rect);
member this.SetClip : System.Drawing.Rectangle -> unit
Public Sub SetClip (rect As Rectangle)

パラメーター

rect
Rectangle

新しいクリップ領域を表す Rectangle 構造体。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • クリッピング領域の小さな四角形を作成します。

  • クリッピング領域を四角形に設定します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、塗りつぶされた小さな黒い四角形になります。

public:
   void SetClipRectangle( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      Rectangle clipRect = Rectangle(0,0,100,100);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangle(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangle(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New Rectangle(0, 0, 100, 100)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

適用対象

SetClip(Graphics)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を指定した GraphicsClip プロパティに設定します。

public:
 void SetClip(System::Drawing::Graphics ^ g);
public void SetClip (System.Drawing.Graphics g);
member this.SetClip : System.Drawing.Graphics -> unit
Public Sub SetClip (g As Graphics)

パラメーター

g
Graphics

新しいクリップ領域の取得元となる Graphics

次のコード例は、Windows フォームで使用するように設計されており、この例では イベント ハンドラーthisFormFormPaint パラメーターである と、 が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • 例の からthisFormForm一時的Graphicsな を作成します。

  • 一時 Graphics のクリッピング領域を小さな四角形に設定します。

  • フォームのグラフィック オブジェクトのクリッピング領域を一時的Graphicsな の領域に更新します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、小さく塗りつぶされた黒い四角形になります。

public:
   void SetClipGraphics( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphics(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphics(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

適用対象

SetClip(GraphicsPath)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を指定した GraphicsPath オブジェクトに設定します。

public:
 void SetClip(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void SetClip (System.Drawing.Drawing2D.GraphicsPath path);
member this.SetClip : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub SetClip (path As GraphicsPath)

パラメーター

path
GraphicsPath

新しいクリップ領域を表す GraphicsPath

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • グラフィックス パスを作成し、パスに省略記号を追加します。

  • クリッピング領域を楕円パスに設定します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、塗りつぶされた黒い楕円になります。

public:
   void SetClipPath( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPath(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPath(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

注釈

パラメーターで path 表されるグラフィックス パスが閉じられない場合は、パスを閉じる最後のポイントから最初のポイントにセグメントが追加されます。

適用対象

SetClip(GraphicsPath, CombineMode)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics のクリッピング領域を、現在のクリップ領域と指定した GraphicsPath とを組み合わせる指定の操作の結果に設定します。

public:
 void SetClip(System::Drawing::Drawing2D::GraphicsPath ^ path, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Drawing2D.GraphicsPath path, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Drawing2D.GraphicsPath * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (path As GraphicsPath, combineMode As CombineMode)

パラメーター

path
GraphicsPath

組み合わせる GraphicsPath

combineMode
CombineMode

使用する組み合わせ操作を指定する CombineMode 列挙体のメンバー。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • グラフィックス パスを作成し、パスに省略記号を追加します。

  • クリッピング領域を、メンバーを含む楕円パスに Replace 設定します。

  • 大きな四角形に黒い単色のブラシを塗りつぶします。

結果は、塗りつぶされた黒い楕円になります。

public:
   void SetClipPathCombine( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath, CombineMode::Replace );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPathCombine(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPathCombine(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

注釈

パラメーターで表されるグラフィックス パスが閉じていない場合、パスを path 閉じるには、最後のポイントから最初のポイントにセグメントが追加されます。

適用対象