Region.Xor Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
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
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
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 comcomplementRect
.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
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
Exceções
region
é null
.
Exemplos
Para obter um exemplo de código, consulte os Xor(RectangleF) métodos e Complement(GraphicsPath) .
Aplica-se a
Comentários
https://aka.ms/ContentUserFeedback.
Em breve: Ao longo de 2024, eliminaremos os problemas do GitHub como o mecanismo de comentários para conteúdo e o substituiremos por um novo sistema de comentários. Para obter mais informações, consulteEnviar e exibir comentários de