Udostępnij przez


Region.Xor Metoda

Definicja

Aktualizacje ten Region obiekt do unii minus przecięcie samego siebie z określonym GraphicsPath obiektem.

Przeciążenia

Xor(GraphicsPath)

Aktualizacje to Region do unii minus skrzyżowanie siebie z określonym GraphicsPath.

Xor(Rectangle)

Aktualizacje to Region do unii minus skrzyżowanie się z określoną Rectangle strukturą.

Xor(RectangleF)

Aktualizacje to Region do unii minus skrzyżowanie się z określoną RectangleF strukturą.

Xor(Region)

Aktualizacje to Region do unii minus skrzyżowanie siebie z określonym Region.

Xor(GraphicsPath)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do unii minus skrzyżowanie siebie z określonym 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

Element GraphicsPath do Xor z tym Regionelementem .

Wyjątki

path to null.

Przykłady

Aby zapoznać się z przykładem kodu, zobacz Xor(RectangleF) metody i Complement(GraphicsPath) .

Dotyczy

Xor(Rectangle)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do unii minus skrzyżowanie się z określoną Rectangle strukturą.

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 do Xor z tym Regionelementem .

Przykłady

Aby zapoznać się z przykładem kodu, zobacz metodę Xor(RectangleF) .

Dotyczy

Xor(RectangleF)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do unii minus skrzyżowanie się z określoną RectangleF strukturą.

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 do Xor(GraphicsPath) z tym Regionelementem .

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy pierwszy prostokąt i rysuje go na ekranie w kolorze czarnym.

  • Tworzy drugi prostokąt i rysuje go na ekranie na czerwono.

  • Tworzy region przy użyciu pierwszego prostokąta.

  • Pobiera obszar dla myRegion polecenia w połączeniu Xor z elementem complementRect.

  • Xor Wypełnia obszar niebieskim i rysuje go na ekranie.

Zwróć uwagę, że oba prostokąty są wypełnione niebieskim, z wyjątkiem obszaru nakładania się.

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

Dotyczy

Xor(Region)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do unii minus skrzyżowanie siebie z określonym 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

Element Region do Xor z tym Regionelementem .

Wyjątki

region to null.

Przykłady

Aby zapoznać się z przykładem kodu, zobacz Xor(RectangleF) metody i Complement(GraphicsPath) .

Dotyczy