Aracılığıyla paylaş


Graphics.SetClip Yöntem

Tanım

Bu Graphics kırpma bölgesini belirtilen GraphicsClip özelliğine ayarlar.

Aşırı Yüklemeler

SetClip(Region, CombineMode)

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesiyle belirtilen Regionbirleştirerek belirtilen işlemin sonucuna ayarlar.

SetClip(RectangleF, CombineMode)

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesini ve bir RectangleF yapısı tarafından belirtilen dikdörtgeni birleştiren belirtilen işlemin sonucuna ayarlar.

SetClip(Rectangle, CombineMode)

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesini ve bir Rectangle yapısı tarafından belirtilen dikdörtgeni birleştiren belirtilen işlemin sonucuna ayarlar.

SetClip(Graphics, CombineMode)

Bu Graphics kırpma bölgesini geçerli klip bölgesinin belirtilen birleştirme işleminin sonucuna ve belirtilen GraphicsClip özelliğine ayarlar.

SetClip(RectangleF)

Bu Graphics kırpma bölgesini bir RectangleF yapısı tarafından belirtilen dikdörtgene ayarlar.

SetClip(Rectangle)

Bu Graphics kırpma bölgesini bir Rectangle yapısı tarafından belirtilen dikdörtgene ayarlar.

SetClip(Graphics)

Bu Graphics kırpma bölgesini belirtilen GraphicsClip özelliğine ayarlar.

SetClip(GraphicsPath)

Bu Graphics kırpma bölgesini belirtilen GraphicsPathayarlar.

SetClip(GraphicsPath, CombineMode)

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesiyle belirtilen GraphicsPathbirleştirerek belirtilen işlemin sonucuna ayarlar.

SetClip(Region, CombineMode)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesiyle belirtilen Regionbirleştirerek belirtilen işlemin sonucuna ayarlar.

public:
 void SetClip(System::Drawing::Region ^ region, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Region region, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Region * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (region As Region, combineMode As CombineMode)

Parametreler

region
Region

Birleştirmek için Region.

combineMode
CombineMode

Kullanılacak birleştirme işlemini belirten CombineMode numaralandırmasından üye.

Örnekler

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

  • Kırpma bölgesi için küçük bir dikdörtgen oluşturur.

  • Kırpma bölgesini Replace üyesiyle dikdörtgene ayarlar.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç küçük, dolgulu, siyah bir dikdörtgendir.

public:
   void SetClipRegionCombine( PaintEventArgs^ e )
   {
      // Create region for clipping.
      System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(0,0,100,100) );

      // Set clipping region of graphics to region.
      e->Graphics->SetClip( clipRegion, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRegionCombine(PaintEventArgs e)
{

    // Create region for clipping.
    Region clipRegion = new Region(new Rectangle(0, 0, 100, 100));

    // Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRegionCombine(ByVal e As PaintEventArgs)

    ' Create region for clipping.
    Dim clipRegion As New [Region](New Rectangle(0, 0, 100, 100))

    ' Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Şunlara uygulanır

SetClip(RectangleF, CombineMode)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesini ve bir RectangleF yapısı tarafından belirtilen dikdörtgeni birleştiren belirtilen işlemin sonucuna ayarlar.

public:
 void SetClip(System::Drawing::RectangleF rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.RectangleF rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.RectangleF * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As RectangleF, combineMode As CombineMode)

Parametreler

rect
RectangleF

Birleştirmek için RectangleF yapı.

combineMode
CombineMode

Kullanılacak birleştirme işlemini belirten CombineMode numaralandırmasının üyesi.

Örnekler

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

  • Kırpma bölgesi için küçük bir dikdörtgen oluşturur.

  • Kırpma bölgesini Replace üyesiyle dikdörtgene ayarlar.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç küçük, dolgulu, siyah bir dikdörtgendir.

public:
   void SetClipRectangleFCombine( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleFCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleFCombine(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Şunlara uygulanır

SetClip(Rectangle, CombineMode)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesini ve bir Rectangle yapısı tarafından belirtilen dikdörtgeni birleştiren belirtilen işlemin sonucuna ayarlar.

public:
 void SetClip(System::Drawing::Rectangle rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Rectangle rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Rectangle * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As Rectangle, combineMode As CombineMode)

Parametreler

rect
Rectangle

Birleştirmek için Rectangle yapı.

combineMode
CombineMode

Kullanılacak birleştirme işlemini belirten CombineMode numaralandırmasının üyesi.

Örnekler

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

  • Kırpma bölgesi için küçük bir dikdörtgen oluşturur.

  • Kırpma bölgesini Replace üyesiyle dikdörtgene ayarlar.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç küçük, dolgulu, siyah bir dikdörtgendir.

public:
   void SetClipRectangleCombine( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      Rectangle clipRect = Rectangle(0,0,100,100);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleCombine(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New Rectangle(0, 0, 100, 100)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Şunlara uygulanır

SetClip(Graphics, CombineMode)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini geçerli klip bölgesinin belirtilen birleştirme işleminin sonucuna ve belirtilen GraphicsClip özelliğine ayarlar.

public:
 void SetClip(System::Drawing::Graphics ^ g, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Graphics g, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Graphics * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (g As Graphics, combineMode As CombineMode)

Parametreler

g
Graphics

Birleştirecek küçük resim bölgesini belirten Graphics.

combineMode
CombineMode

Kullanılacak birleştirme işlemini belirten CombineMode numaralandırmasının üyesi.

Örnekler

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

  • Örneğin thisFormForm geçici bir Graphics oluşturur.

  • Geçici Graphics kırpma bölgesini küçük bir kareye ayarlar.

  • Formun grafik nesnesinin kırpma bölgesini yeni GraphicsReplace üyesiyle güncelleştirir.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç küçük, dolgulu, siyah bir karedir.

public:
   void SetClipGraphicsCombine( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphicsCombine(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphicsCombine(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

Şunlara uygulanır

SetClip(RectangleF)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini bir RectangleF yapısı tarafından belirtilen dikdörtgene ayarlar.

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

Parametreler

rect
RectangleF

Yeni küçük resim bölgesini temsil eden RectangleF yapı.

Örnekler

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

  • Kırpma bölgesi için küçük bir dikdörtgen oluşturur.

  • Kırpma bölgesini dikdörtgen olarak ayarlar.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç küçük, dolgulu, siyah bir dikdörtgendir.

public:
   void SetClipRectangleF( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleF(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleF(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Şunlara uygulanır

SetClip(Rectangle)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini bir Rectangle yapısı tarafından belirtilen dikdörtgene ayarlar.

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

Parametreler

rect
Rectangle

Yeni küçük resim bölgesini temsil eden Rectangle yapı.

Örnekler

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

  • Kırpma bölgesi için küçük bir dikdörtgen oluşturur.

  • Kırpma bölgesini dikdörtgen olarak ayarlar.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç küçük, dolgulu, siyah bir dikdörtgendir.

public:
   void SetClipRectangle( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      Rectangle clipRect = Rectangle(0,0,100,100);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangle(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangle(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New Rectangle(0, 0, 100, 100)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Şunlara uygulanır

SetClip(Graphics)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini belirtilen GraphicsClip özelliğine ayarlar.

public:
 void SetClip(System::Drawing::Graphics ^ g);
public void SetClip (System.Drawing.Graphics g);
member this.SetClip : System.Drawing.Graphics -> unit
Public Sub SetClip (g As Graphics)

Parametreler

g
Graphics

Yeni küçük resim bölgesinin alındığı Graphics.

Örnekler

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

  • Örneğin thisFormForm geçici bir Graphics oluşturur.

  • Geçici Graphics kırpma bölgesini küçük bir kareye ayarlar.

  • Formun grafik nesnesinin kırpma bölgesini geçici Graphicsile güncelleştirir.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç küçük, dolgulu, siyah bir karedir.

public:
   void SetClipGraphics( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphics(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphics(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

Şunlara uygulanır

SetClip(GraphicsPath)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini belirtilen GraphicsPathayarlar.

public:
 void SetClip(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void SetClip (System.Drawing.Drawing2D.GraphicsPath path);
member this.SetClip : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub SetClip (path As GraphicsPath)

Parametreler

path
GraphicsPath

Yeni küçük resim bölgesini temsil eden GraphicsPath.

Örnekler

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

  • Bir grafik yolu oluşturur ve yola üç nokta ekler.

  • Kırpma bölgesini eliptik yola ayarlar.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç, dolu, siyah üç noktadır.

public:
   void SetClipPath( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPath(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPath(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Açıklamalar

path parametresi tarafından temsil edilen grafik yolu kapatılmazsa, yolu kapatmak için son noktadan ilk noktaya ek bir kesim eklenir.

Şunlara uygulanır

SetClip(GraphicsPath, CombineMode)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Bu Graphics kırpma bölgesini, geçerli küçük resim bölgesiyle belirtilen GraphicsPathbirleştirerek belirtilen işlemin sonucuna ayarlar.

public:
 void SetClip(System::Drawing::Drawing2D::GraphicsPath ^ path, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Drawing2D.GraphicsPath path, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Drawing2D.GraphicsPath * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (path As GraphicsPath, combineMode As CombineMode)

Parametreler

path
GraphicsPath

Birleştirmek için GraphicsPath.

combineMode
CombineMode

Kullanılacak birleştirme işlemini belirten CombineMode numaralandırmasının üyesi.

Örnekler

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

  • Bir grafik yolu oluşturur ve yola üç nokta ekler.

  • Kırpma bölgesini, Replace üyesiyle eliptik yola ayarlar.

  • Büyük bir dikdörtgeni düz siyah bir fırçayla doldurur.

Sonuç, dolu, siyah üç noktadır.

public:
   void SetClipPathCombine( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath, CombineMode::Replace );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPathCombine(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPathCombine(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Açıklamalar

path parametresi tarafından temsil edilen grafik yolu kapatılmazsa, yolu kapatmak için son noktadan ilk noktaya ek bir kesim eklenir.

Şunlara uygulanır