Region.Xor Méthode

Définition

Met à jour cet Region objet vers l’union moins l’intersection de lui-même avec l’objet spécifié GraphicsPath .

Surcharges

Nom Description
Xor(GraphicsPath)

Met à jour cela Region à l’union moins l’intersection de lui-même avec le spécifié GraphicsPath.

Xor(Rectangle)

Met à jour cette Region opération vers l’union moins l’intersection de lui-même avec la structure spécifiée Rectangle .

Xor(RectangleF)

Met à jour cette Region opération vers l’union moins l’intersection de lui-même avec la structure spécifiée RectangleF .

Xor(Region)

Met à jour cela Region à l’union moins l’intersection de lui-même avec le spécifié Region.

Xor(GraphicsPath)

Met à jour cela Region à l’union moins l’intersection de lui-même avec le spécifié 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)

Paramètres

path
GraphicsPath

C’est avec GraphicsPathXor cela Region.

Exceptions

path a la valeur null.

Exemples

Pour obtenir un exemple de code, consultez les méthodes et Complement(GraphicsPath) les Xor(RectangleF) méthodes.

S’applique à

Xor(Rectangle)

Met à jour cette Region opération vers l’union moins l’intersection de lui-même avec la structure spécifiée 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)

Paramètres

rect
Rectangle

Structure Rectangle à laquelle Xor cela Regionest associé .

Exemples

Pour obtenir un exemple de code, consultez la Xor(RectangleF) méthode.

S’applique à

Xor(RectangleF)

Met à jour cette Region opération vers l’union moins l’intersection de lui-même avec la structure spécifiée 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)

Paramètres

rect
RectangleF

Structure RectangleF à laquelle Xor(GraphicsPath) cela Regionest associé .

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms, et nécessite PaintEventArgse, qui est un paramètre du gestionnaire d’événements Paint. Le code effectue les actions suivantes :

  • Crée le premier rectangle et le dessine sur l’écran en noir.

  • Crée un deuxième rectangle et le dessine sur l’écran en rouge.

  • Crée une région à l’aide du premier rectangle.

  • Obtient la Xor zone pour myRegion laquelle elle est combinée avec complementRect.

  • Remplit la zone avec du Xor bleu et la dessine à l’écran.

Notez que les deux rectangles sont remplis de bleu, à l’exception de la zone de chevauchement.

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

S’applique à

Xor(Region)

Met à jour cela Region à l’union moins l’intersection de lui-même avec le spécifié 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)

Paramètres

region
Region

C’est avec RegionXor cela Region.

Exceptions

region a la valeur null.

Exemples

Pour obtenir un exemple de code, consultez les méthodes et Complement(GraphicsPath) les Xor(RectangleF) méthodes.

S’applique à