次の方法で共有


Graphics.ExcludeClip メソッド (Region)

Region オブジェクトで指定された領域が除外されるように、この Graphics オブジェクトのクリップ領域を更新します。

Overloads Public Sub ExcludeClip( _
   ByVal region As Region _)
[C#]
public void ExcludeClip(Regionregion);
[C++]
public: void ExcludeClip(Region* region);
[JScript]
public function ExcludeClip(
   region : Region);

パラメータ

  • region
    クリップ領域から除外する領域を指定する Region オブジェクト。

戻り値

このメソッドは値を返しません。

解説

このメソッドは、 region パラメータで指定された領域を現在のクリップ領域から除外し、残りの領域をこの Graphics オブジェクトの Clip プロパティに割り当てます。

使用例

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

  • 左上隅が座標 (100, 100) に位置する 100 ピクセル × 100 ピクセルの四角形を作成します。
  • 四角形が除外されるようにクリッピング領域を設定します。
  • 左上隅が座標 (0, 0) に位置する 300 ピクセル × 300 ピクセルの四角形を青いソリッド ブラシで塗りつぶします。

[Visual Basic, C#] 右下隅の方の正方形領域がない青の四角形が生成されます。

 
Public Sub ExcludeClipRegion(e As PaintEventArgs)
' Create rectangle for exclusion.
Dim excludeRect As New Rectangle(100, 100, 200, 200)
' Set clipping region to exclude rectangle.
e.Graphics.ExcludeClip(excludeRect)
' Fill large rectangle to show clipping region.
e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
300, 300)
End Sub
        
[C#] 
public void ExcludeClipRegion(PaintEventArgs e)
{
// Create rectangle for exclusion.
Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
// Set clipping region to exclude rectangle.
e.Graphics.ExcludeClip(excludeRect);
// Fill large rectangle to show clipping region.
e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.ExcludeClip オーバーロードの一覧