Region.Exclude Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Přetížení
| Name | Description |
|---|---|
| Exclude(Region) |
Aktualizuje to Region tak, aby obsahoval pouze část jeho interiéru, která se neprotíná se zadaným Region. |
| Exclude(GraphicsPath) |
Aktualizuje to Region tak, aby obsahoval pouze část jeho interiéru, která se neprotíná se zadaným GraphicsPath. |
| Exclude(Rectangle) |
Aktualizuje tuto možnost Region tak, aby obsahovala pouze část jejího interiéru, která se neprotíná se zadanou Rectangle strukturou. |
| Exclude(RectangleF) |
Aktualizuje tuto možnost Region tak, aby obsahovala pouze část jejího interiéru, která se neprotíná se zadanou RectangleF strukturou. |
Exclude(Region)
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
public:
void Exclude(System::Drawing::Region ^ region);
public void Exclude(System.Drawing.Region region);
member this.Exclude : System.Drawing.Region -> unit
Public Sub Exclude (region As Region)
Parametry
Výjimky
region je null.
Příklady
Příklady kódu najdete v tématu Exclude(RectangleF) a Complement(Region) metody.
Platí pro
Exclude(GraphicsPath)
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
Aktualizuje to Region tak, aby obsahoval pouze část jeho interiéru, která se neprotíná se zadaným GraphicsPath.
public:
void Exclude(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void Exclude(System.Drawing.Drawing2D.GraphicsPath path);
member this.Exclude : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub Exclude (path As GraphicsPath)
Parametry
- path
- GraphicsPath
Možnost GraphicsPath vyloučení z tohoto Regionsouboru .
Výjimky
path je null.
Příklady
Následující příklad kódu ukazuje Region konstruktor a Exclude metody a Dispose metody.
Tento příklad je navržený tak, aby se používal s model Windows Forms. Vložte kód do formuláře a zavolejte metodu FillRegionExcludingPath při zpracování události formuláře Paint a předejte e jako PaintEventArgs.
private:
void FillRegionExcludingPath( PaintEventArgs^ e )
{
// Create the region using a rectangle.
System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( Rectangle(20,20,100,100) );
// Create the GraphicsPath.
System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath;
// Add a circle to the graphics path.
path->AddEllipse( 50, 50, 25, 25 );
// Exclude the circle from the region.
myRegion->Exclude( path );
// Retrieve a Graphics object from the form.
Graphics^ formGraphics = e->Graphics;
// Fill the region in blue.
formGraphics->FillRegion( Brushes::Blue, myRegion );
// Dispose of the path and region objects.
delete path;
delete myRegion;
}
private void FillRegionExcludingPath(PaintEventArgs e)
{
// Create the region using a rectangle.
Region myRegion = new Region(new Rectangle(20, 20, 100, 100));
// Create the GraphicsPath.
System.Drawing.Drawing2D.GraphicsPath path =
new System.Drawing.Drawing2D.GraphicsPath();
// Add a circle to the graphics path.
path.AddEllipse(50, 50, 25, 25);
// Exclude the circle from the region.
myRegion.Exclude(path);
// Retrieve a Graphics object from the form.
Graphics formGraphics = e.Graphics;
// Fill the region in blue.
formGraphics.FillRegion(Brushes.Blue, myRegion);
// Dispose of the path and region objects.
path.Dispose();
myRegion.Dispose();
}
Private Sub FillRegionExcludingPath(ByVal e As PaintEventArgs)
' Create the region using a rectangle.
Dim myRegion As New Region(New Rectangle(20, 20, 100, 100))
' Create the GraphicsPath.
Dim path As New System.Drawing.Drawing2D.GraphicsPath
' Add a circle to the graphics path.
path.AddEllipse(50, 50, 25, 25)
' Exclude the circle from the region.
myRegion.Exclude(path)
' Retrieve a Graphics object from the form.
Dim formGraphics As Graphics = e.Graphics
' Fill the region in blue.
formGraphics.FillRegion(Brushes.Blue, myRegion)
' Dispose of the path and region objects.
path.Dispose()
myRegion.Dispose()
End Sub
Platí pro
Exclude(Rectangle)
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
public:
void Exclude(System::Drawing::Rectangle rect);
public void Exclude(System.Drawing.Rectangle rect);
member this.Exclude : System.Drawing.Rectangle -> unit
Public Sub Exclude (rect As Rectangle)
Parametry
Příklady
Příklad kódu najdete v Exclude(RectangleF) metodě.
Platí pro
Exclude(RectangleF)
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
- Zdroj:
- Region.cs
Aktualizuje tuto možnost Region tak, aby obsahovala pouze část jejího interiéru, která se neprotíná se zadanou RectangleF strukturou.
public:
void Exclude(System::Drawing::RectangleF rect);
public void Exclude(System.Drawing.RectangleF rect);
member this.Exclude : System.Drawing.RectangleF -> unit
Public Sub Exclude (rect As RectangleF)
Parametry
- rect
- RectangleF
Struktura RectangleF , která má být vyloučena z této Region.
Příklady
Následující příklad je určen pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:
Vytvoří obdélník a nakreslí ho na obrazovku černou.
Vytvoří druhý obdélník, který protíná první a nakreslí ho na obrazovku červeně.
Vytvoří oblast pomocí prvního obdélníku.
Získá nerozlehlé oblasti oblasti v kombinaci s druhým obdélníkem.
Vyplní oblast, která není odlehlé, modrou a nakreslí ji na obrazovku.
Všimněte si, že oblast oblasti oblasti oblasti, která se neprotíná s obdélníkem, je barevná modrá.
public:
void Exclude_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 nonexcluded area of myRegion when combined with
// complementRect.
myRegion->Exclude( complementRect );
// Fill the nonexcluded area of myRegion with blue.
SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
e->Graphics->FillRegion( myBrush, myRegion );
}
public void Exclude_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 nonexcluded area of myRegion when combined with
// complementRect.
myRegion.Exclude(complementRect);
// Fill the nonexcluded area of myRegion with blue.
SolidBrush myBrush = new SolidBrush(Color.Blue);
e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Exclude_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 nonexcluded area of myRegion when combined with
' complementRect.
myRegion.Exclude(complementRect)
' Fill the nonexcluded area of myRegion with blue.
Dim myBrush As New SolidBrush(Color.Blue)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub