Region.MakeEmpty Método
Definição
public:
void MakeEmpty();
public void MakeEmpty ();
member this.MakeEmpty : unit -> unit
Public Sub MakeEmpty ()
Exemplos
O exemplo de código a seguir demonstra como usar o Region Construtor e o MakeEmpty método.The following code example demonstrates how to use the Region constructor and MakeEmpty method. Este exemplo foi projetado para ser usado com Windows Forms.This example is designed to be used with Windows Forms. Crie um formulário e cole o código a seguir nele.Create a form and paste the following code into it. Chame o FillEmptyRegion método no método de manipulação de eventos do formulário Paint , passando e como PaintEventArgs .Call the FillEmptyRegion method in the form's Paint event-handling method, passing e as 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