Graphics.ExcludeClip Metoda

Definicja

Aktualizacje regionu klipu, Graphics aby wykluczyć obszar określony przez Rectangle strukturę.

Przeciążenia

ExcludeClip(Region)

Aktualizacje regionu klipu w tym Graphics celu, aby wykluczyć obszar określony przez Regionobiekt .

ExcludeClip(Rectangle)

Aktualizacje regionu klipu, Graphics aby wykluczyć obszar określony przez Rectangle strukturę.

ExcludeClip(Region)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Aktualizacje regionu klipu w tym Graphics celu, aby wykluczyć obszar określony przez Regionobiekt .

public:
 void ExcludeClip(System::Drawing::Region ^ region);
public void ExcludeClip (System.Drawing.Region region);
member this.ExcludeClip : System.Drawing.Region -> unit
Public Sub ExcludeClip (region As Region)

Parametry

region
Region

Region określa region do wykluczenia z regionu klipu.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy prostokąt 100 pikseli o rozmiarze 100 pikseli, którego lewy górny róg znajduje się na współrzędnych (100, 100).

  • Ustawia region przycinania, aby wykluczyć prostokąt.

  • Wypełnia prostokąt 300 pikseli o 300 pikseli, którego lewy górny róg znajduje się na współrzędnych (0, 0) z niebieskim pędzlem.

Wynikiem jest niebieski prostokąt z obszarem kwadratowym w kierunku jego brakującego prawego dolnego rogu.

public:
   void ExcludeClipRegion( PaintEventArgs^ e )
   {
      // Create rectangle for region.
      Rectangle excludeRect = Rectangle(100,100,200,200);

      // Create region for exclusion.
      System::Drawing::Region^ excludeRegion = gcnew System::Drawing::Region( excludeRect );

      // Set clipping region to exclude region.
      e->Graphics->ExcludeClip( excludeRegion );

      // Fill large rectangle to show clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 );
   }
public void ExcludeClipRegion(PaintEventArgs e)
{
             
    // Create rectangle for region.
    Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
             
    // Create region for exclusion.
    Region excludeRegion = new Region(excludeRect);
             
    // Set clipping region to exclude region.
    e.Graphics.ExcludeClip(excludeRegion);
             
    // Fill large rectangle to show clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
}
Public Sub ExcludeClipRegion(ByVal e As PaintEventArgs)

    ' Create rectangle for region.
    Dim excludeRect As New Rectangle(100, 100, 200, 200)

    ' Create region for exclusion.
    Dim excludeRegion As New [Region](excludeRect)

    ' Set clipping region to exclude region.
    e.Graphics.ExcludeClip(excludeRegion)

    ' Fill large rectangle to show clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    300, 300)
End Sub

Uwagi

Ta metoda wyklucza obszar określony przez region parametr z bieżącego regionu klipu i przypisuje wynikowy obszar do Clip właściwości tego Graphicsobiektu .

Dotyczy

ExcludeClip(Rectangle)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Aktualizacje regionu klipu, Graphics aby wykluczyć obszar określony przez Rectangle strukturę.

public:
 void ExcludeClip(System::Drawing::Rectangle rect);
public void ExcludeClip (System.Drawing.Rectangle rect);
member this.ExcludeClip : System.Drawing.Rectangle -> unit
Public Sub ExcludeClip (rect As Rectangle)

Parametry

rect
Rectangle

Rectangle struktura określająca prostokąt do wykluczenia z regionu klipu.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy prostokąt 100 pikseli o rozmiarze 100 pikseli, którego lewy górny róg znajduje się na współrzędnych (100, 100).

  • Tworzy region zdefiniowany przez prostokąt.

  • Ustawia region przycinania, aby wykluczyć prostokątny region.

  • Wypełnia prostokąt 300 pikseli o 300 pikseli, którego lewy górny róg znajduje się na współrzędnych (0, 0) z niebieskim pędzlem.

Wynikiem jest niebieski prostokąt z regionem kwadratowym w kierunku brakującego dolnego rogu.

public:
   void ExcludeClipRectangle( PaintEventArgs^ e )
   {
      // Create rectangle for exclusion.
      Rectangle excludeRect = Rectangle(100,100,200,200);

      // Set clipping region to exclude rectangle.
      e->Graphics->ExcludeClip( excludeRect );

      // Fill large rectangle to show clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 );
   }
public void ExcludeClipRectangle(PaintEventArgs e)
{
             
    // Create rectangle for exclusion.
    Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
             
    // Set clipping region to exclude rectangle.
    e.Graphics.ExcludeClip(excludeRect);
             
    // Fill large rectangle to show clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
}
Public Sub ExcludeClipRectangle(ByVal e As PaintEventArgs)

    ' Create rectangle for exclusion.
    Dim excludeRect As New Rectangle(100, 100, 200, 200)

    ' Set clipping region to exclude rectangle.
    e.Graphics.ExcludeClip(excludeRect)

    ' Fill large rectangle to show clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    300, 300)
End Sub

Uwagi

Ta metoda wyklucza obszar określony przez rect parametr z bieżącego regionu klipu i przypisuje wynikowy obszar do Clip właściwości tego Graphicsobiektu .

Dotyczy