Compartir a través de


Region.MakeInfinite Método

Definición

Inicializa este objeto Region con un interior infinito.

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

Ejemplos

En el ejemplo de código siguiente se muestra cómo utilizar el método MakeInfinite. 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 FillInfiniteRegion( 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 MakeInfinite.
      smallRegion->MakeInfinite();

      // Fill the region in red and draw the original rectangle
      // in black. Note that the entire form is filled in.
      e->Graphics->FillRegion( Brushes::Red, smallRegion );
      e->Graphics->DrawRectangle( Pens::Black, originalRectangle );
   }
private void FillInfiniteRegion(PaintEventArgs e)
{
    // Create a region from a rectangle.
    Rectangle originalRectangle = new Rectangle(40, 40, 40, 50);
    Region smallRegion = new Region(originalRectangle);

    // Call MakeInfinite.
    smallRegion.MakeInfinite();

    // Fill the region in red and draw the original rectangle
    // in black. Note that the entire form is filled in.
    e.Graphics.FillRegion(Brushes.Red, smallRegion);
    e.Graphics.DrawRectangle(Pens.Black, originalRectangle);
}
Private Sub FillInfiniteRegion(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 MakeInfinite.
    smallRegion.MakeInfinite()

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

End Sub

Se aplica a