Region.MakeEmpty Método

Definición

Inicializa esta Region con un interior vacío.

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

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar el constructor y MakeEmpty el Region método . Este ejemplo está diseñado para usarse con Windows Forms. Create un formulario y pegue el código siguiente en él. Llame al FillEmptyRegion método en el método de control de eventos del Paint formulario, pasando e como PaintEventArgs.

private:
   void FillEmptyRegion( PaintEventArgs^ e )
   {
      // Create a region from a rectangle.
      Rectangle originalRectangle = Rectangle(40,40,40,50);
      System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle );

      // Call MakeEmpty.
      smallRegion->MakeEmpty();

      // Fill the region in red and draw the original rectangle
      // in black. Note there is nothing filled in.
      e->Graphics->FillRegion( Brushes::Red, smallRegion );
      e->Graphics->DrawRectangle( Pens::Black, originalRectangle );
   }
private void FillEmptyRegion(PaintEventArgs e)
{

    // Create a region from a rectangle.
    Rectangle originalRectangle = new Rectangle(40, 40, 40, 50);
    Region smallRegion = new Region(originalRectangle);

    // Call MakeEmpty.
    smallRegion.MakeEmpty();

    // Fill the region in red and draw the original rectangle
    // in black. Note there is nothing filled in.
    e.Graphics.FillRegion(Brushes.Red, smallRegion);
    e.Graphics.DrawRectangle(Pens.Black, originalRectangle);
}
Private Sub FillEmptyRegion(ByVal e As PaintEventArgs)

    ' Create a region from a rectangle.
    Dim originalRectangle As New Rectangle(40, 40, 40, 50)
    Dim smallRegion As New Region(originalRectangle)

    ' Call MakeEmpty.
    smallRegion.MakeEmpty()

    ' Fill the region in red and draw the original rectangle
    ' in black. Note there is nothing filled in.
    e.Graphics.FillRegion(Brushes.Red, smallRegion)
    e.Graphics.DrawRectangle(Pens.Black, originalRectangle)

End Sub

Se aplica a