Graphics.SetClipとは? わかりやすく解説

Graphics.SetClip メソッド (GraphicsPath)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    path As GraphicsPath _
)
Dim instance As Graphics
Dim path As GraphicsPath

instance.SetClip(path)
public void SetClip (
    GraphicsPath path
)
public:
void SetClip (
    GraphicsPath^ path
)
public void SetClip (
    GraphicsPath path
)
public function SetClip (
    path : GraphicsPath
)

パラメータ

path

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

解説解説
使用例使用例

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

黒で塗りつぶされた楕円が生成されます。

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (Region, CombineMode)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    region As Region, _
    combineMode As CombineMode _
)
Dim instance As Graphics
Dim region As Region
Dim combineMode As CombineMode

instance.SetClip(region, combineMode)
public void SetClip (
    Region region,
    CombineMode combineMode
)
public:
void SetClip (
    Region^ region, 
    CombineMode combineMode
)
public void SetClip (
    Region region, 
    CombineMode combineMode
)
public function SetClip (
    region : Region, 
    combineMode : CombineMode
)

パラメータ

region

組み合わせる Region。

combineMode

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

使用例使用例

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

黒で塗りつぶされた小さな四角形が生成されます。

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (Graphics)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    g As Graphics _
)
public void SetClip (
    Graphics g
)
public:
void SetClip (
    Graphics^ g
)
public void SetClip (
    Graphics g
)

パラメータ

g

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

使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse と、たとえば Form などの thisForm が必要です。このコードは次のアクションを実行します。

黒で塗りつぶされた小さな正方形が生成されます。

Public 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
public 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();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (RectangleF)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    rect As RectangleF _
)
Dim instance As Graphics
Dim rect As RectangleF

instance.SetClip(rect)
public void SetClip (
    RectangleF rect
)
public:
void SetClip (
    RectangleF rect
)
public void SetClip (
    RectangleF rect
)
public function SetClip (
    rect : RectangleF
)

パラメータ

rect

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

使用例使用例

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

黒で塗りつぶされた小さな四角形が生成されます。

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (Rectangle)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    rect As Rectangle _
)
Dim instance As Graphics
Dim rect As Rectangle

instance.SetClip(rect)
public void SetClip (
    Rectangle rect
)
public:
void SetClip (
    Rectangle rect
)
public void SetClip (
    Rectangle rect
)
public function SetClip (
    rect : Rectangle
)

パラメータ

rect

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

使用例使用例

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

黒で塗りつぶされた小さな四角形が生成されます。

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (Graphics, CombineMode)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    g As Graphics, _
    combineMode As CombineMode _
)
Dim instance As Graphics
Dim g As Graphics
Dim combineMode As CombineMode

instance.SetClip(g, combineMode)
public void SetClip (
    Graphics g,
    CombineMode combineMode
)
public:
void SetClip (
    Graphics^ g, 
    CombineMode combineMode
)
public void SetClip (
    Graphics g, 
    CombineMode combineMode
)
public function SetClip (
    g : Graphics, 
    combineMode : CombineMode
)

パラメータ

g

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

combineMode

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

使用例使用例

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse と、たとえば Form などの thisForm が必要です。このコードは次のアクションを実行します。

黒で塗りつぶされた小さな正方形が生成されます。

Public 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
public 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();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (GraphicsPath, CombineMode)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    path As GraphicsPath, _
    combineMode As CombineMode _
)
Dim instance As Graphics
Dim path As GraphicsPath
Dim combineMode As CombineMode

instance.SetClip(path, combineMode)
public void SetClip (
    GraphicsPath path,
    CombineMode combineMode
)
public:
void SetClip (
    GraphicsPath^ path, 
    CombineMode combineMode
)
public void SetClip (
    GraphicsPath path, 
    CombineMode combineMode
)
public function SetClip (
    path : GraphicsPath, 
    combineMode : CombineMode
)

パラメータ

path

組み合わせる GraphicsPath。

combineMode

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

解説解説
使用例使用例

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

黒で塗りつぶされた楕円が生成されます。

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (Rectangle, CombineMode)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    rect As Rectangle, _
    combineMode As CombineMode _
)
Dim instance As Graphics
Dim rect As Rectangle
Dim combineMode As CombineMode

instance.SetClip(rect, combineMode)
public void SetClip (
    Rectangle rect,
    CombineMode combineMode
)
public:
void SetClip (
    Rectangle rect, 
    CombineMode combineMode
)
public void SetClip (
    Rectangle rect, 
    CombineMode combineMode
)
public function SetClip (
    rect : Rectangle, 
    combineMode : CombineMode
)

パラメータ

rect

組み合わせる Rectangle 構造体。

combineMode

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

使用例使用例

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

黒で塗りつぶされた小さな四角形が生成されます。

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド (RectangleF, CombineMode)

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

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub SetClip ( _
    rect As RectangleF, _
    combineMode As CombineMode _
)
Dim instance As Graphics
Dim rect As RectangleF
Dim combineMode As CombineMode

instance.SetClip(rect, combineMode)
public void SetClip (
    RectangleF rect,
    CombineMode combineMode
)
public:
void SetClip (
    RectangleF rect, 
    CombineMode combineMode
)
public void SetClip (
    RectangleF rect, 
    CombineMode combineMode
)
public function SetClip (
    rect : RectangleF, 
    combineMode : CombineMode
)

パラメータ

rect

組み合わせる RectangleF 構造体。

combineMode

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

使用例使用例

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

黒で塗りつぶされた小さな四角形が生成されます。

Public 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
public 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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.SetClip メソッド

この Graphics のクリッピング領域を指定した Graphics の Clip プロパティに設定します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
Graphics.SetClip (Graphics) この Graphics のクリッピング領域を指定した Graphics の Clip プロパティに設定します。
Graphics.SetClip (GraphicsPath) この Graphics のクリッピング領域を指定した GraphicsPath オブジェクトに設定します。
Graphics.SetClip (Rectangle) この Graphics のクリッピング領域を Rectangle 構造体で指定された四角形に設定します。
Graphics.SetClip (RectangleF) この Graphics のクリッピング領域を RectangleF 構造体で指定された四角形に設定します。
Graphics.SetClip (Graphics, CombineMode) この Graphics のクリッピング領域を、現在のクリップ領域と指定した Graphics の Clip プロパティとを組み合わせる指定の操作の結果に設定します。
Graphics.SetClip (GraphicsPath, CombineMode) この Graphics のクリッピング領域を、現在のクリップ領域と指定した GraphicsPath とを組み合わせる指定の操作の結果に設定します。
Graphics.SetClip (Rectangle, CombineMode) この Graphics のクリッピング領域を現在のクリップ領域と Rectangle 構造体で指定された四角形とを組み合わせる指定の操作の結果に設定します。
Graphics.SetClip (RectangleF, CombineMode) この Graphics のクリッピング領域を現在のクリップ領域と RectangleF 構造体で指定された四角形とを組み合わせる指定の操作の結果に設定します。
Graphics.SetClip (Region, CombineMode) この Graphics のクリッピング領域を、現在のクリップ領域と指定した Region とを組み合わせる指定の操作の結果に設定します。
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「Graphics.SetClip」の関連用語

Graphics.SetClipのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Graphics.SetClipのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS