Share via


Region.Xor Metoda

Definice

Aktualizace tento Region objekt do sjednocení minus průnik sebe sama se zadaným GraphicsPath objektem.

Přetížení

Xor(GraphicsPath)

Aktualizace do Region sjednocení minus průnik sebe sama se zadaným GraphicsPath.

Xor(Rectangle)

Aktualizace toto Region sjednocení minus průnik sebe sama se zadanou Rectangle strukturou.

Xor(RectangleF)

Aktualizace toto Region sjednocení minus průnik sebe sama se zadanou RectangleF strukturou.

Xor(Region)

Aktualizace do Region sjednocení minus průnik sebe sama se zadaným Region.

Xor(GraphicsPath)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace do Region sjednocení minus průnik sebe sama se zadaným 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)

Parametry

path
GraphicsPath

To GraphicsPath s Xor tímto Region.

Výjimky

path je null.

Příklady

Příklad kódu najdete v metodách Xor(RectangleF) a Complement(GraphicsPath) .

Platí pro

Xor(Rectangle)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace toto Region sjednocení minus průnik sebe sama se zadanou Rectangle strukturou.

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)

Parametry

rect
Rectangle

Struktura Rectangle pro Xor s tímto Region.

Příklady

Příklad kódu najdete v Xor(RectangleF) metodě.

Platí pro

Xor(RectangleF)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace toto Region sjednocení minus průnik sebe sama se zadanou RectangleF strukturou.

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)

Parametry

rect
RectangleF

Struktura RectangleF pro Xor(GraphicsPath) s tímto Region.

Příklady

Následující příklad kódu je určen pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

  • Vytvoří první obdélník a nakreslí ho na obrazovku černě.

  • Vytvoří druhý obdélník a červeně ho nakreslí na obrazovku.

  • Vytvoří oblast pomocí prvního obdélníku.

  • Xor Získá oblast pro myRegion v kombinaci s complementRect.

  • Xor Vyplní oblast modrou a nakreslí ji na obrazovku.

Všimněte si, že oba obdélníky jsou vyplněné modře s výjimkou oblasti překrytí.

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

Platí pro

Xor(Region)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace do Region sjednocení minus průnik sebe sama se zadaným 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)

Parametry

region
Region

To Region s Xor tímto Region.

Výjimky

region je null.

Příklady

Příklad kódu najdete v metodách Xor(RectangleF) a Complement(GraphicsPath) .

Platí pro