Region.Complement Yöntem

Tanım

Bunu Region belirtilen RectangleF yapının bu ile Regionkesişmeyen bölümüne güncelleştirir.

Aşırı Yüklemeler

Name Description
Complement(Region)

Bunu Region , belirtilen Region öğesinin bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

Complement(RectangleF)

Bunu Region , belirtilen RectangleF yapının bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

Complement(GraphicsPath)

Bunu Region , belirtilen GraphicsPath öğesinin bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

Complement(Rectangle)

Bunu Region , belirtilen Rectangle yapının bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

Complement(Region)

Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs

Bunu Region , belirtilen Region öğesinin bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

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)

Parametreler

region
Region

Bu RegionRegion nesneyi tamamlayacak nesne.

Özel durumlar

region, null'e eşittir.

Örnekler

Aşağıdaki örnek, Windows Forms ile kullanılmak üzere tasarlanmıştır ve olay işleyicisinin PaintEventArgs parametresi olan öğesini gerektirir.ePaint Kod aşağıdaki eylemleri gerçekleştirir:

  • Dikdörtgen oluşturur ve siyah olarak ekrana çizer

  • İlkiyle kesişen ve kırmızı renkle ekrana çizen ikinci bir dikdörtgen oluşturur.

  • İlk dikdörtgeni kullanarak bir bölge oluşturur ve ikinci dikdörtgeni kullanarak ikinci bir bölge oluşturur.

  • İkinci bölgeyle birleştirildiğinde bu ilk bölgenin tamamlayıcısını alır.

  • Tamamlayıcı alanı mavi ile doldurur ve ekrana çizer.

İkinci bölgenin ilk bölgeyle kesişmeyen alanının mavi renkli olduğuna dikkat edin.

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

Şunlara uygulanır

Complement(RectangleF)

Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs

Bunu Region , belirtilen RectangleF yapının bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

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)

Parametreler

rect
RectangleF

Bunu RectangleFRegiontamamlayacak yapı.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve PaintEventArgs olay işleyicisinin bir parametresi olan ePaint gerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  • Bir dikdörtgen oluşturur ve siyah olarak ekrana çizer.

  • İlkiyle kesişen ve kırmızı renkle ekrana çizen ikinci bir dikdörtgen oluşturur.

  • İlk dikdörtgeni kullanarak bir bölge oluşturur.

  • bu bölgenin tamamlayıcısını ikinci dikdörtgenle birleştirir.

  • Tamamlayıcı alanı mavi ile doldurur ve ekrana çizer.

İkinci dikdörtgenin bölgeyle kesişmeyen alanının mavi renkli olduğuna dikkat edin.

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

Şunlara uygulanır

Complement(GraphicsPath)

Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs

Bunu Region , belirtilen GraphicsPath öğesinin bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

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)

Parametreler

path
GraphicsPath

GraphicsPath bunu tamamlamak için öğesini seçinRegion.

Özel durumlar

path, null'e eşittir.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve PaintEventArgs olay işleyicisinin bir parametresi olan ePaint gerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  • Bir dikdörtgen oluşturur ve siyah olarak ekrana çizer.

  • İlkiyle kesişen ve kırmızı renkle ekrana çizen ikinci bir dikdörtgen oluşturur.

  • İlk dikdörtgeni kullanarak bir bölge oluşturur.

  • bir GraphicsPatholuşturur ve ikinci dikdörtgeni ekler.

  • ile birleştirildiğinde bölgenin tamamlayıcısını GraphicsPathalır.

  • Tamamlayıcı alanı mavi ile doldurur ve ekrana çizer.

bölgeyle kesişmeyen alanının GraphicsPath mavi renkli olduğuna dikkat edin.

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

Şunlara uygulanır

Complement(Rectangle)

Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs
Kaynak:
Region.cs

Bunu Region , belirtilen Rectangle yapının bu ile Regionkesişmeyen bölümünü içerecek şekilde güncelleştirir.

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)

Parametreler

rect
Rectangle

Bunu RectangleRegiontamamlayacak yapı.

Örnekler

Bir örnek için yöntemine Complement(RectangleF) bakın.

Şunlara uygulanır