Region.Complement Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt dit Region bijgewerkt naar het gedeelte van de opgegeven RectangleF structuur dat hiermee niet wordt gekruist Region.
Overloads
| Name | Description |
|---|---|
| Complement(Region) |
Hiermee wordt het Region gedeelte bijgewerkt dat het deel van de opgegeven Region dat niet met dit Regionkruist. |
| Complement(RectangleF) |
Hiermee wordt het Region gedeelte van de opgegeven RectangleF structuur bijgewerkt dat niet met deze Regionstructuur wordt gekruist. |
| Complement(GraphicsPath) |
Hiermee wordt het Region gedeelte bijgewerkt dat het deel van de opgegeven GraphicsPath dat niet met dit Regionkruist. |
| Complement(Rectangle) |
Hiermee wordt het Region gedeelte van de opgegeven Rectangle structuur bijgewerkt dat niet met deze Regionstructuur wordt gekruist. |
Complement(Region)
public:
void Complement(System::Drawing::Region ^ region);
public void Complement(System.Drawing.Region region);
member this.Complement : System.Drawing.Region -> unit
Public Sub Complement (region As Region)
Parameters
Uitzonderingen
region is null.
Voorbeelden
Het volgende voorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een parameter van de Paint gebeurtenis-handler. De code voert de volgende acties uit:
Hiermee maakt u een rechthoek en tekent u deze op het scherm in zwart
Hiermee maakt u een tweede rechthoek die met de eerste kruist en deze in rood naar het scherm tekent.
Hiermee maakt u één regio met behulp van de eerste rechthoek en maakt u een tweede regio met behulp van de tweede rechthoek.
Haalt het complement van die eerste regio op in combinatie met de tweede regio.
Vult het complementgebied met blauw en tekent het op het scherm.
U ziet dat het gebied van de tweede regio dat niet met het eerste gebied kruist blauw is.
public:
void Complement_Region_Example( 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.
Rectangle complementRect = Rectangle(90,30,100,100);
e->Graphics->DrawRectangle( Pens::Red, complementRect );
// Create a region from the first rectangle.
System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );
// Create a complement region.
System::Drawing::Region^ complementRegion = gcnew System::Drawing::Region( complementRect );
// Get the complement of myRegion when combined with
// complementRegion.
myRegion->Complement( complementRegion );
// Fill the complement area with blue.
SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
e->Graphics->FillRegion( myBrush, myRegion );
}
public void Complement_Region_Example(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.
Rectangle complementRect = new Rectangle(90, 30, 100, 100);
e.Graphics.DrawRectangle(Pens.Red, complementRect);
// Create a region from the first rectangle.
Region myRegion = new Region(regionRect);
// Create a complement region.
Region complementRegion = new Region(complementRect);
// Get the complement of myRegion when combined with
// complementRegion.
myRegion.Complement(complementRegion);
// Fill the complement area with blue.
SolidBrush myBrush = new SolidBrush(Color.Blue);
e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Complement_Region_Example(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 complementRect As New Rectangle(90, 30, 100, 100)
e.Graphics.DrawRectangle(Pens.Red, complementRect)
' create a region from the first rectangle.
Dim myRegion As New [Region](regionRect)
' Create a complement region.
Dim complementRegion As New [Region](complementRect)
' Get the complement of myRegion when combined with
' complementRegion.
myRegion.Complement(complementRegion)
' Fill the complement area with blue.
Dim myBrush As New SolidBrush(Color.Blue)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub
Van toepassing op
Complement(RectangleF)
Hiermee wordt het Region gedeelte van de opgegeven RectangleF structuur bijgewerkt dat niet met deze Regionstructuur wordt gekruist.
public:
void Complement(System::Drawing::RectangleF rect);
public void Complement(System.Drawing.RectangleF rect);
member this.Complement : System.Drawing.RectangleF -> unit
Public Sub Complement (rect As RectangleF)
Parameters
- rect
- RectangleF
De RectangleF structuur om dit Regionaan te vullen .
Voorbeelden
Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een parameter van de Paint gebeurtenis-handler. De code voert de volgende acties uit:
Hiermee maakt u een rechthoek en tekent u deze op het scherm in zwart.
Hiermee maakt u een tweede rechthoek die met de eerste kruist en deze in rood naar het scherm tekent.
Hiermee maakt u een regio met behulp van de eerste rechthoek.
Hiermee haalt u het complement van dat gebied op in combinatie met de tweede rechthoek.
Vult het complementgebied met blauw en tekent het op het scherm.
U ziet dat het gebied van de tweede rechthoek die niet met het gebied kruist blauw is.
public:
void Complement_RectF_Example( 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 complementRect = RectangleF(90,30,100,100);
e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) );
// Create a region using the first rectangle.
System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );
// Get the complement of the region combined with the second
// rectangle.
myRegion->Complement( complementRect );
// Fill the complement area with blue.
SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
e->Graphics->FillRegion( myBrush, myRegion );
}
public void Complement_RectF_Example(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 complementRect = new RectangleF(90, 30, 100, 100);
e.Graphics.DrawRectangle(Pens.Red,
Rectangle.Round(complementRect));
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
// Get the complement of the region combined with the second
// rectangle.
myRegion.Complement(complementRect);
// Fill the complement area with blue.
SolidBrush myBrush = new SolidBrush(Color.Blue);
e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Complement_RectF_Example(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 complementRect As New RectangleF(90, 30, 100, 100)
e.Graphics.DrawRectangle(Pens.Red, _
Rectangle.Round(complementRect))
' Create a region using the first rectangle.
Dim myRegion As New [Region](regionRect)
' Get the complement of the region combined with the second
' rectangle.
myRegion.Complement(complementRect)
' Fill the complement area with blue.
Dim myBrush As New SolidBrush(Color.Blue)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub
Van toepassing op
Complement(GraphicsPath)
Hiermee wordt het Region gedeelte bijgewerkt dat het deel van de opgegeven GraphicsPath dat niet met dit Regionkruist.
public:
void Complement(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void Complement(System.Drawing.Drawing2D.GraphicsPath path);
member this.Complement : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub Complement (path As GraphicsPath)
Parameters
- path
- GraphicsPath
Het GraphicsPath is een aanvulling op dit Region.
Uitzonderingen
path is null.
Voorbeelden
Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een parameter van de Paint gebeurtenis-handler. De code voert de volgende acties uit:
Hiermee maakt u een rechthoek en tekent u deze op het scherm in zwart.
Hiermee maakt u een tweede rechthoek die met de eerste kruist en deze in rood naar het scherm tekent.
Hiermee maakt u een regio met behulp van de eerste rechthoek.
Hiermee maakt u een GraphicsPath, en voegt u de tweede rechthoek eraan toe.
Haalt het complement van de regio op in combinatie met de GraphicsPath.
Vult het complementgebied met blauw en tekent het op het scherm.
U ziet dat het gebied van het GraphicsPath gebied dat niet kruist met het gebied blauw is.
public:
void Complement_Path_Example( 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.
Rectangle complementRect = Rectangle(90,30,100,100);
e->Graphics->DrawRectangle( Pens::Red, complementRect );
// Create a graphics path and add the second rectangle to it.
GraphicsPath^ complementPath = gcnew GraphicsPath;
complementPath->AddRectangle( complementRect );
// Create a region using the first rectangle.
System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );
// Get the complement of myRegion when combined with
// complementPath.
myRegion->Complement( complementPath );
// Fill the complement area with blue.
SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
e->Graphics->FillRegion( myBrush, myRegion );
}
public void Complement_Path_Example(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.
Rectangle complementRect = new Rectangle(90, 30, 100, 100);
e.Graphics.DrawRectangle(Pens.Red, complementRect);
// Create a graphics path and add the second rectangle to it.
GraphicsPath complementPath = new GraphicsPath();
complementPath.AddRectangle(complementRect);
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
// Get the complement of myRegion when combined with
// complementPath.
myRegion.Complement(complementPath);
// Fill the complement area with blue.
SolidBrush myBrush = new SolidBrush(Color.Blue);
e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Complement_Path_Example(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 complementRect As New Rectangle(90, 30, 100, 100)
e.Graphics.DrawRectangle(Pens.Red, complementRect)
' Create a graphics path and add the second rectangle to it.
Dim complementPath As New GraphicsPath
complementPath.AddRectangle(complementRect)
' Create a region using the first rectangle.
Dim myRegion As New [Region](regionRect)
' Get the complement of myRegion when combined with
' complementPath.
myRegion.Complement(complementPath)
' Fill the complement area with blue.
Dim myBrush As New SolidBrush(Color.Blue)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub
Van toepassing op
Complement(Rectangle)
public:
void Complement(System::Drawing::Rectangle rect);
public void Complement(System.Drawing.Rectangle rect);
member this.Complement : System.Drawing.Rectangle -> unit
Public Sub Complement (rect As Rectangle)
Parameters
Voorbeelden
Zie de Complement(RectangleF) methode voor een voorbeeld.