Region.Xor Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Atualiza este Region objeto para a união menos a interseção de si próprio com o objeto especificado GraphicsPath .
Sobrecargas
| Name | Description |
|---|---|
| Xor(GraphicsPath) |
Atualiza isto Region para a união menos a interseção de si mesma com o especificado GraphicsPath. |
| Xor(Rectangle) |
Atualiza isto Region para a união menos a interseção de si própria com a estrutura especificada Rectangle . |
| Xor(RectangleF) |
Atualiza isto Region para a união menos a interseção de si própria com a estrutura especificada RectangleF . |
| Xor(Region) |
Atualiza isto Region para a união menos a interseção de si mesma com o especificado Region. |
Xor(GraphicsPath)
Atualiza isto Region para a união menos a interseção de si mesma com o especificado 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)
Parâmetros
- path
- GraphicsPath
O GraphicsPath para Xor com isto Region.
Exceções
path é null.
Exemplos
Para um exemplo de código, veja os Xor(RectangleF) métodos e Complement(GraphicsPath) .
Aplica-se a
Xor(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)
Parâmetros
Exemplos
Para um exemplo de código, veja o Xor(RectangleF) método.
Aplica-se a
Xor(RectangleF)
Atualiza isto Region para a união menos a interseção de si própria com a estrutura especificada 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)
Parâmetros
- rect
- RectangleF
A RectangleF estrutura para Xor(GraphicsPath) com isto Region.
Exemplos
O seguinte exemplo de código foi concebido para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do tratador de eventos Paint. O código executa as seguintes ações:
Cria o primeiro retângulo e desenha-o para o ecrã a preto.
Cria um segundo retângulo e desenha-o para o ecrã em vermelho.
Cria uma região usando o primeiro retângulo.
Obtém a Xor área para
myRegionquando combinado comcomplementRect.Preenche a Xor área com azul e desenha-a para o ecrã.
Note que ambos os retângulos estão preenchidos com azul, exceto na á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)
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 um exemplo de código, veja os Xor(RectangleF) métodos e Complement(GraphicsPath) .