次の方法で共有


Graphics.ExcludeClip メソッド (Rectangle)

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

Overloads Public Sub ExcludeClip( _
   ByVal rect As Rectangle _)
[C#]
public void ExcludeClip(Rectanglerect);
[C++]
public: void ExcludeClip(Rectanglerect);
[JScript]
public function ExcludeClip(
   rect : Rectangle);

パラメータ

  • rect
    クリップ領域から除外する四角形を指定する Rectangle 構造体。

戻り値

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

解説

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

使用例

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

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

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

 
Public Sub ExcludeClipRectangle(e As PaintEventArgs)
' Create rectangle for region.
Dim excludeRect As New Rectangle(100, 100, 200, 200)
' Create region for exclusion.
Dim excludeRegion As New [Region](excludeRect)
' Set clipping region to exclude region.
e.Graphics.ExcludeClip(excludeRegion)
' Fill large rectangle to show clipping region.
e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
300, 300)
End Sub
        
[C#] 
public void ExcludeClipRectangle(PaintEventArgs e)
{
// Create rectangle for region.
Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
// Create region for exclusion.
Region excludeRegion = new Region(excludeRect);
// Set clipping region to exclude region.
e.Graphics.ExcludeClip(excludeRegion);
// 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 オーバーロードの一覧