Region.Xor Método

Definição

Atualiza este objeto Region para a união menos a interseção de si mesmo com o objeto GraphicsPath especificado.

Sobrecargas

Xor(GraphicsPath)

Atualiza este Region para a união menos a interseção de si mesmo com o GraphicsPath especificado.

Xor(Rectangle)

Atualiza essa Region à união menos a interseção de si mesmo com a estrutura Rectangle especificada.

Xor(RectangleF)

Atualiza essa Region à união menos a interseção de si mesmo com a estrutura RectangleF especificada.

Xor(Region)

Atualiza este Region para a união menos a interseção de si mesmo com o Region especificado.

Xor(GraphicsPath)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza este Region para a união menos a interseção de si mesmo com o GraphicsPath especificado.

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)

Parâmetros

path
GraphicsPath

O GraphicsPath para Xor com este Region.

Exceções

path é null.

Exemplos

Para obter um exemplo de código, consulte os Xor(RectangleF) métodos e Complement(GraphicsPath) .

Aplica-se a

Xor(Rectangle)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza essa Region à união menos a interseção de si mesmo com a estrutura Rectangle especificada.

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)

Parâmetros

rect
Rectangle

A estrutura Rectangle a Xor com esse Region.

Exemplos

Para obter um exemplo de código, consulte o Xor(RectangleF) método .

Aplica-se a

Xor(RectangleF)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza essa Region à união menos a interseção de si mesmo com a estrutura RectangleF especificada.

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)

Parâmetros

rect
RectangleF

A estrutura RectangleF a Xor(GraphicsPath) com esse Region.

Exemplos

O exemplo de código a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do Paint manipulador de eventos. O código executa as seguintes ações:

  • Cria o primeiro retângulo e o desenha para a tela em preto.

  • Cria um segundo retângulo e o desenha para a tela em vermelho.

  • Cria uma região usando o primeiro retângulo.

  • Obtém a Xor área para myRegion quando combinado com complementRect.

  • Preenche a Xor área com azul e a desenha para a tela.

Observe que ambos os retângulos são preenchidos com azul, exceto pela área de sobreposição.

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

Aplica-se a

Xor(Region)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza este Region para a união menos a interseção de si mesmo com o Region especificado.

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)

Parâmetros

region
Region

O Region para Xor com este Region.

Exceções

region é null.

Exemplos

Para obter um exemplo de código, consulte os Xor(RectangleF) métodos e Complement(GraphicsPath) .

Aplica-se a