この Region オブジェクトと交差しない指定の RectangleF 構造体の部分に、この Region オブジェクトを更新します。
オーバーロードの一覧
この Region オブジェクトと交差しない指定の GraphicsPath オブジェクトの部分が含まれるようにこの Region オブジェクトを更新します。
[Visual Basic] Overloads Public Sub Complement(GraphicsPath)
この Region オブジェクトと交差しない指定の Rectangle 構造体の部分が含まれるように、この Region オブジェクトを更新します。
.NET Compact Framework でもサポート。
[Visual Basic] Overloads Public Sub Complement(Rectangle)
[JScript] public function Complement(Rectangle);
この Region オブジェクトと交差しない指定の RectangleF 構造体の部分が含まれるよう、この Region オブジェクトを更新します。
[Visual Basic] Overloads Public Sub Complement(RectangleF)
[JScript] public function Complement(RectangleF);
この Region オブジェクトと交差しない指定の Region オブジェクトの部分が含まれるよう、この Region オブジェクトを更新します。
.NET Compact Framework でもサポート。
[Visual Basic] Overloads Public Sub Complement(Region)
[JScript] public function Complement(Region);
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- 四角形を作成し、黒で画面に描画します。
- 最初の四角形と交差する 2 番目の四角形を作成し、赤で画面に描画します。
- 最初の四角形を使用した領域と、2 番目の四角形を使用した領域を作成します。
- 2 つ目の領域と組み合わせたときの最初の補足領域を取得します。
- 青で補足領域を塗りつぶし、画面に描画します。
[Visual Basic, C#] 最初の領域と交差しない 2 番目の領域の色は青になります。
[Visual Basic, C#] メモ ここでは、Complement のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
Public Sub Complement_Region_Example(e As PaintEventArgs)
' Create the first rectangle and draw it to the screen in black.
Dim regionRect As New Rectangle(20, 20, 100, 100)
e.Graphics.DrawRectangle(Pens.Black, regionRect)
' Create the second rectangle and draw it to the screen in red.
Dim complementRect As New Rectangle(90, 30, 100, 100)
e.Graphics.DrawRectangle(Pens.Red, complementRect)
' create a region from the first rectangle.
Dim myRegion As New [Region](regionRect)
' Create a complement region.
Dim complementRegion As New [Region](complementRect)
' Get the complement of myRegion when combined with
' complementRegion.
myRegion.Complement(complementRegion)
' Fill the complement area with blue.
Dim myBrush As New SolidBrush(Color.Blue)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub
[C#]
public void Complement_Region_Example(PaintEventArgs e)
{
// Create the first rectangle and draw it to the screen in black.
Rectangle regionRect = new Rectangle(20, 20, 100, 100);
e.Graphics.DrawRectangle(Pens.Black, regionRect);
// Create the second rectangle and draw it to the screen in red.
Rectangle complementRect = new Rectangle(90, 30, 100, 100);
e.Graphics.DrawRectangle(Pens.Red, complementRect);
// Create a region from the first rectangle.
Region myRegion = new Region(regionRect);
// Create a complement region.
Region complementRegion = new Region(complementRect);
// Get the complement of myRegion when combined with
// complementRegion.
myRegion.Complement(complementRegion);
// Fill the complement area with blue.
SolidBrush myBrush = new SolidBrush(Color.Blue);
e.Graphics.FillRegion(myBrush, myRegion);
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。