Region.Xor メソッド

定義

この Region オブジェクトを、そのオブジェクトと指定の GraphicsPath オブジェクトの交差部分を差し引いた和集合に更新します。

オーバーロード

Xor(GraphicsPath)

この Region を、それ自体と指定の GraphicsPath の交差部分を差し引いた和集合に更新します。

Xor(Rectangle)

この Region を、それ自体と指定の Rectangle 構造体の交差部分を差し引いた和集合に更新します。

Xor(RectangleF)

この Region を、それ自体と指定の RectangleF 構造体の交差部分を差し引いた和集合に更新します。

Xor(Region)

この Region を、それ自体と指定の Region の交差部分を差し引いた和集合に更新します。

Xor(GraphicsPath)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の GraphicsPath の交差部分を差し引いた和集合に更新します。

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

パラメーター

path
GraphicsPath

この GraphicsPathXor 演算する Region

例外

pathnullです。

コード例については、 メソッドと Complement(GraphicsPath) メソッドをXor(RectangleF)参照してください。

適用対象

Xor(Rectangle)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の Rectangle 構造体の交差部分を差し引いた和集合に更新します。

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

パラメーター

rect
Rectangle

この RectangleXor 演算する Region 構造体。

コード例については、 メソッドを Xor(RectangleF) 参照してください。

適用対象

Xor(RectangleF)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の RectangleF 構造体の交差部分を差し引いた和集合に更新します。

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

パラメーター

rect
RectangleF

この RectangleFXor(GraphicsPath) 演算する Region 構造体。

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

  • 最初の四角形を作成し、黒で画面に描画します。

  • 2 番目の四角形を作成し、赤で画面に描画します。

  • 最初の四角形を使用して領域を作成します。

  • Xor 組み合わせた場合の の myRegion 領域を complementRect取得します。

  • 領域を Xor 青で塗りつぶし、画面に描画します。

重複する領域を除き、両方の四角形が青で塗りつぶされていることに注意してください。

void XorExample( PaintEventArgs^ e )
{
   // Create the first rectangle and draw it to the screen in black.
   Rectangle regionRect = Rectangle(20,20,100,100);
   e->Graphics->DrawRectangle( Pens::Black, regionRect );

   // create the second rectangle and draw it to the screen in red.
   RectangleF xorRect = RectangleF(90,30,100,100);
   e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( xorRect ) );

   // Create a region using the first rectangle.
   System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );

   // Get the area of overlap for myRegion when combined with
   // complementRect.
   myRegion->Xor( xorRect );

   // Fill the Xor area of myRegion with blue.
   SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
   e->Graphics->FillRegion( myBrush, myRegion );
}
public void XorExample(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.
    RectangleF xorRect = new RectangleF(90, 30, 100, 100);
    e.Graphics.DrawRectangle(Pens.Red,
        Rectangle.Round(xorRect));
             
    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Get the area of overlap for myRegion when combined with
             
    // complementRect.
    myRegion.Xor(xorRect);
             
    // Fill the Xor area of myRegion with blue.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub XorExample(ByVal 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 xorRect As New RectangleF(90, 30, 100, 100)
    e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(xorRect))

    ' Create a region using the first rectangle.
    Dim myRegion As New [Region](regionRect)

    ' Get the area of overlap for myRegion when combined with
    ' complementRect.
    myRegion.Xor(xorRect)

    ' Fill the intersection area of myRegion with blue.
    Dim myBrush As New SolidBrush(Color.Blue)
    e.Graphics.FillRegion(myBrush, myRegion)
End Sub

適用対象

Xor(Region)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の Region の交差部分を差し引いた和集合に更新します。

public:
 void Xor(System::Drawing::Region ^ region);
public void Xor (System.Drawing.Region region);
member this.Xor : System.Drawing.Region -> unit
Public Sub Xor (region As Region)

パラメーター

region
Region

この RegionXor 演算する Region

例外

regionnullです。

コード例については、 メソッドと Complement(GraphicsPath) メソッドをXor(RectangleF)参照してください。

適用対象