Share via


Region.Xor Metodo

Definizione

Aggiorna questo oggetto Region all'unione meno l'intersezione dello stesso con l'oggetto GraphicsPath specificato.

Overload

Xor(GraphicsPath)

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la classe GraphicsPath specificata.

Xor(Rectangle)

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la struttura Rectangle specificata.

Xor(RectangleF)

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la struttura RectangleF specificata.

Xor(Region)

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la classe Region specificata.

Xor(GraphicsPath)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la classe GraphicsPath specificata.

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)

Parametri

path
GraphicsPath

Classe GraphicsPath da Xor con questa classe Region.

Eccezioni

path è null.

Esempio

Per un esempio di codice, vedere i Xor(RectangleF) metodi e Complement(GraphicsPath) .

Si applica a

Xor(Rectangle)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la struttura Rectangle specificata.

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)

Parametri

rect
Rectangle

Struttura Rectangle a cui applicare Xor con questa classe Region.

Esempio

Per un esempio di codice, vedere il Xor(RectangleF) metodo .

Si applica a

Xor(RectangleF)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la struttura RectangleF specificata.

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)

Parametri

rect
RectangleF

Struttura RectangleF a cui applicare Xor(GraphicsPath) con questa classe Region.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Crea il primo rettangolo e lo disegna sullo schermo in nero.

  • Crea un secondo rettangolo e lo disegna sullo schermo in rosso.

  • Crea un'area usando il primo rettangolo.

  • Ottiene l'area Xor per myRegion quando viene combinata con complementRect.

  • Riempie l'area Xor con blu e lo disegna sullo schermo.

Si noti che entrambi i rettangoli vengono riempiti con blu, ad eccezione dell'area di sovrapposizione.

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

Si applica a

Xor(Region)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione meno l'intersezione della stessa con la classe Region specificata.

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)

Parametri

region
Region

Classe Region da Xor con questa classe Region.

Eccezioni

region è null.

Esempio

Per un esempio di codice, vedere i Xor(RectangleF) metodi e Complement(GraphicsPath) .

Si applica a