Region Constructeurs

Définition

Initialise un nouveau Region.

Surcharges

Nom Description
Region()

Initialise un nouveau Region.

Region(GraphicsPath)

Initialise un nouveau Region avec le fichier spécifié GraphicsPath.

Region(RegionData)

Initialise une nouvelle Region à partir des données spécifiées.

Region(Rectangle)

Initialise une nouvelle Region à partir de la structure spécifiée Rectangle .

Region(RectangleF)

Initialise une nouvelle Region à partir de la structure spécifiée RectangleF .

Region()

Initialise un nouveau Region.

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

Remarques

Ce constructeur initialise un nouvel Region intérieur infini.

S’applique à

Region(GraphicsPath)

Initialise un nouveau Region avec le fichier spécifié 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)

Paramètres

path
GraphicsPath

Qui GraphicsPath définit le nouveau Region.

Exceptions

path a la valeur null.

Remarques

Cette méthode crée un nouveau Region avec un GraphicsPath. La nouvelle région est définie comme l’intérieur du GraphicsPath paramètre spécifié path .

S’applique à

Region(RegionData)

Initialise une nouvelle Region à partir des données spécifiées.

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)

Paramètres

rgnData
RegionData

Qui RegionData définit l’intérieur du nouveau Region.

Exceptions

rgnData a la valeur null.

Remarques

Cette méthode crée une nouvelle Region avec un intérieur défini par un élément existant Region. Le rgnData paramètre est un tableau qui contient la définition d’un objet existant Region.

S’applique à

Region(Rectangle)

Initialise une nouvelle Region à partir de la structure spécifiée Rectangle .

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)

Paramètres

rect
Rectangle

Structure Rectangle qui définit l’intérieur du nouveau Region.

Exemples

L’exemple de code suivant montre comment utiliser le constructeur et MakeEmpty la Region méthode. Cet exemple est conçu pour être utilisé avec Windows Forms. Créez un formulaire et collez-y le code suivant. Appelez la méthode dans la FillEmptyRegion méthode de gestion des événements du Paint formulaire, en passant e en tant que 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

Remarques

Cette méthode crée une nouvelle Region avec un intérieur rectangulaire. L’intérieur est défini par le rect paramètre.

S’applique à

Region(RectangleF)

Initialise une nouvelle Region à partir de la structure spécifiée RectangleF .

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)

Paramètres

rect
RectangleF

Structure RectangleF qui définit l’intérieur du nouveau Region.

Remarques

Cette méthode crée une nouvelle Region avec un intérieur rectangulaire. L’intérieur est défini par le rect paramètre.

S’applique à