Graphics.Clip Özellik

Tanım

Bu Regionöğesinin çizim bölgesini sınırlayan bir Graphics alır veya ayarlar.

public:
 property System::Drawing::Region ^ Clip { System::Drawing::Region ^ get(); void set(System::Drawing::Region ^ value); };
public System.Drawing.Region Clip { get; set; }
member this.Clip : System.Drawing.Region with get, set
Public Property Clip As Region

Özellik Değeri

Region Bunun şu anda çizim için kullanılabilir olan bölümünü Graphics sınırlayan bir.

Örnekler

Aşağıdaki kod örneği özelliğinin Clip kullanımını gösterir. Bu örnek, Windows Forms ile kullanılacak şekilde tasarlanmıştır. Kodu bir forma yapıştırın ve formun SetAndFillClipPaint olayını işlerken yöntemini olarak geçirerek ePaintEventArgsçağırın.

private:
   void SetAndFillClip( PaintEventArgs^ e )
   {
      // Set the Clip property to a new region.
      e->Graphics->Clip = gcnew System::Drawing::Region( Rectangle(10,10,100,200) );

      // Fill the region.
      e->Graphics->FillRegion( Brushes::LightSalmon, e->Graphics->Clip );

      // Demonstrate the clip region by drawing a string
      // at the outer edge of the region.
      e->Graphics->DrawString( "Outside of Clip", gcnew System::Drawing::Font( "Arial",12.0F,FontStyle::Regular ), Brushes::Black, 0.0F, 0.0F );
   }
private void SetAndFillClip(PaintEventArgs e)
{

    // Set the Clip property to a new region.
    e.Graphics.Clip = new Region(new Rectangle(10, 10, 100, 200));

    // Fill the region.
    e.Graphics.FillRegion(Brushes.LightSalmon, e.Graphics.Clip);

    // Demonstrate the clip region by drawing a string
    // at the outer edge of the region.
    e.Graphics.DrawString("Outside of Clip", new Font("Arial", 
        12.0F, FontStyle.Regular), Brushes.Black, 0.0F, 0.0F);
}
Private Sub SetAndFillClip(ByVal e As PaintEventArgs)

    ' Set the Clip property to a new region.
    e.Graphics.Clip = New Region(New Rectangle(10, 10, 100, 200))

    ' Fill the region.
    e.Graphics.FillRegion(Brushes.LightSalmon, e.Graphics.Clip)

    ' Demonstrate the clip region by drawing a string
    ' at the outer edge of the region.
    e.Graphics.DrawString("Outside of Clip", _
        New Font("Arial", 12.0F, FontStyle.Regular), _
        Brushes.Black, 0.0F, 0.0F)

End Sub

Açıklamalar

Region özelliği tarafından Clip döndürülen nesneyi değiştirmek, nesneyle Graphics sonraki çizimi etkilemez. Küçük resim bölgesini değiştirmek için özellik değerini yeni Clip bir nesneyle değiştirinRegion. Kırpma bölgesinin sonsuz olup olmadığını belirlemek için özelliğini alın Clip ve yöntemini çağırın IsInfinite .

Şunlara uygulanır