Region Region Region Region Constructors

Definition

Overloads

Region() Region() Region()

Initializes a new Region.

Region(GraphicsPath) Region(GraphicsPath) Region(GraphicsPath) Region(GraphicsPath)

Initializes a new Region with the specified GraphicsPath.

Region(RegionData) Region(RegionData) Region(RegionData) Region(RegionData)

Initializes a new Region from the specified data.

Region(Rectangle) Region(Rectangle) Region(Rectangle) Region(Rectangle)

Initializes a new Region from the specified Rectangle structure.

Region(RectangleF) Region(RectangleF) Region(RectangleF) Region(RectangleF)

Initializes a new Region from the specified RectangleF structure.

Region() Region() Region()

Initializes a new Region.

public:
 Region();
public Region ();
Public Sub New ()

Remarks

This constructor initializes a new Region with an infinite interior.

Region(GraphicsPath) Region(GraphicsPath) Region(GraphicsPath) Region(GraphicsPath)

Initializes a new Region with the specified GraphicsPath.

public:
 Region(System::Drawing::Drawing2D::GraphicsPath ^ path);
public Region (System.Drawing.Drawing2D.GraphicsPath path);
new System.Drawing.Region : System.Drawing.Drawing2D.GraphicsPath -> System.Drawing.Region
Public Sub New (path As GraphicsPath)

Parameters

Exceptions

Remarks

This method creates a new Region with a GraphicsPath. The new region is defined as the interior of the GraphicsPath specified by the path parameter.

Region(RegionData) Region(RegionData) Region(RegionData) Region(RegionData)

Initializes a new Region from the specified data.

public:
 Region(System::Drawing::Drawing2D::RegionData ^ rgnData);
public Region (System.Drawing.Drawing2D.RegionData rgnData);
new System.Drawing.Region : System.Drawing.Drawing2D.RegionData -> System.Drawing.Region
Public Sub New (rgnData As RegionData)

Parameters

rgnData
RegionData RegionData RegionData RegionData

A RegionData that defines the interior of the new Region.

Exceptions

Remarks

This method creates a new Region with an interior defined by an existing Region. The rgnData parameter is an array that contains the definition of an existing Region.

Region(Rectangle) Region(Rectangle) Region(Rectangle) Region(Rectangle)

Initializes a new Region from the specified Rectangle structure.

public:
 Region(System::Drawing::Rectangle rect);
public Region (System.Drawing.Rectangle rect);
new System.Drawing.Region : System.Drawing.Rectangle -> System.Drawing.Region
Public Sub New (rect As Rectangle)

Parameters

rect
Rectangle Rectangle Rectangle Rectangle

A Rectangle structure that defines the interior of the new Region.

Examples

The following code example demonstrates how to use the Region constructor and MakeEmpty method. This example is designed to be used with Windows Forms. Create a form and paste the following code into it. 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

Remarks

This method creates a new Region with a rectangular interior. The interior is defined by the rect parameter.

Region(RectangleF) Region(RectangleF) Region(RectangleF) Region(RectangleF)

Initializes a new Region from the specified RectangleF structure.

public:
 Region(System::Drawing::RectangleF rect);
public Region (System.Drawing.RectangleF rect);
new System.Drawing.Region : System.Drawing.RectangleF -> System.Drawing.Region
Public Sub New (rect As RectangleF)

Parameters

rect
RectangleF RectangleF RectangleF RectangleF

A RectangleF structure that defines the interior of the new Region.

Remarks

This method creates a new Region with a rectangular interior. The interior is defined by the rect parameter.

Applies to