Graphics.ResetClip Método

Definición

Restablece la región de recorte de este Graphics en una región infinita.Resets the clip region of this Graphics to an infinite region.

public:
 void ResetClip();
public void ResetClip ();
member this.ResetClip : unit -> unit
Public Sub ResetClip ()

Ejemplos

El siguiente ejemplo de código está diseñado para su uso con Windows Forms y requiere PaintEventArgs e, que Paint es un parámetro del controlador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. El código realiza las siguientes acciones:The code performs the following actions:

  • Crea un rectángulo con la esquina superior izquierda en (0,0) y establece la región de recorte en este rectángulo.Creates a rectangle with upper-left corner at (0, 0) and sets the clipping region to this rectangle.

  • Crea un segundo rectángulo con la esquina superior izquierda en (100, 100) y establece la región de recorte en la intersección de este rectángulo y la región de recorte actual (el primer rectángulo).Creates a second rectangle with upper-left corner at (100, 100) and sets the clipping region to the intersection of this rectangle and the current clipping region (the first rectangle).

  • Rellena un rectángulo grande que incluye ambos rectángulos anteriores con un pincel azul sólido.Fills a large rectangle that includes both previous rectangles with a solid blue brush.

  • Restablece la región de recorte a infinita.Resets the clipping region to infinite.

  • Dibuja rectángulos alrededor de las dos regiones de recorte; usa un lápiz negro para el primer rectángulo de recorte y un lápiz rojo para la segunda región de recorte.Draws rectangles around the two clipping regions; it uses a black pen for the first clipping rectangle and a red pen for the second clipping region.

El resultado es que solo la intersección de los dos rectángulos se rellena con azul.The result is that only the intersection of the two rectangles is filled with blue.

public:
   void IntersectClipRectangleF2( PaintEventArgs^ e )
   {
      // Set clipping region.
      Rectangle clipRect = Rectangle(0,0,200,200);
      e->Graphics->SetClip( clipRect );

      // Update clipping region to intersection of
      // existing region with specified rectangle.
      RectangleF intersectRectF = RectangleF(100.0F,100.0F,200.0F,200.0F);
      e->Graphics->IntersectClip( intersectRectF );

      // Fill rectangle to demonstrate effective clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 );

      // Reset clipping region to infinite.
      e->Graphics->ResetClip();

      // Draw clipRect and intersectRect to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect );
      e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), Rectangle::Round( intersectRectF ) );
   }
private void IntersectClipRectangleF2(PaintEventArgs e)
{

    // Set clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 200, 200);
    e.Graphics.SetClip(clipRect);

    // Update clipping region to intersection of

    // existing region with specified rectangle.
    RectangleF intersectRectF = new RectangleF(100.0F, 100.0F, 200.0F, 200.0F);
    e.Graphics.IntersectClip(intersectRectF);

    // Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);

    // Reset clipping region to infinite.
    e.Graphics.ResetClip();

    // Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
    e.Graphics.DrawRectangle(new Pen(Color.Red), Rectangle.Round(intersectRectF));
}
Private Sub IntersectClipRectangleF2(ByVal e As PaintEventArgs)

    ' Set clipping region.
    Dim clipRect As New Rectangle(0, 0, 200, 200)
    e.Graphics.SetClip(clipRect)

    ' Update clipping region to intersection of

    ' existing region with specified rectangle.
    Dim intersectRectF As New RectangleF(100.0F, 100.0F, 200.0F, 200.0F)
    e.Graphics.IntersectClip(intersectRectF)

    ' Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    500, 500)

    ' Reset clipping region to infinite.
    e.Graphics.ResetClip()

    ' Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Black), clipRect)
    e.Graphics.DrawRectangle(New Pen(Color.Red), _
    Rectangle.Round(intersectRectF))
End Sub

Comentarios

Cuando la región de recorte Graphics de un es infinita, los Graphics elementos que dibuja no se recortan.When the clipping region of a Graphics is infinite, items that this Graphics draws are not clipped.

Se aplica a