Rect Constructeurs
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Initialise une nouvelle instance de la Rect structure.
Surcharges
| Nom | Description |
|---|---|
| Rect(Size) |
Initialise une nouvelle instance de la Rect structure qui est de la taille spécifiée et se trouve à (0,0). |
| Rect(Point, Point) |
Initialise une nouvelle instance de la Rect structure qui est exactement assez grande pour contenir les deux points spécifiés. |
| Rect(Point, Size) |
Initialise une nouvelle instance de la Rect structure qui a l’emplacement d’angle supérieur gauche spécifié et la largeur et la hauteur spécifiées. |
| Rect(Point, Vector) |
Initialise une nouvelle instance de la Rect structure qui est exactement suffisamment grande pour contenir le point spécifié et la somme du point spécifié et du vecteur spécifié. |
| Rect(Double, Double, Double, Double) |
Initialise une nouvelle instance de la Rect structure qui a la coordonnée x, la coordonnée y, la largeur et la hauteur spécifiées. |
Rect(Size)
Initialise une nouvelle instance de la Rect structure qui est de la taille spécifiée et se trouve à (0,0).
public:
Rect(System::Windows::Size size);
public Rect(System.Windows.Size size);
new System.Windows.Rect : System.Windows.Size -> System.Windows.Rect
Public Sub New (size As Size)
Paramètres
Exemples
L’exemple suivant montre comment créer une Rect structure à l’aide du Rect(Size) constructeur.
private Rect createRectExample2()
{
// This constructor initializes a new instance of the Rect structure that
// is of the specified size and is located at (0,0).
Rect myRectangle = new Rect(new Size(200, 50));
// Returns a rectangle with a width of 200, a height of 50 and a position
// of 0,0.
return myRectangle;
}
S’applique à
Rect(Point, Point)
Initialise une nouvelle instance de la Rect structure qui est exactement assez grande pour contenir les deux points spécifiés.
public:
Rect(System::Windows::Point point1, System::Windows::Point point2);
public Rect(System.Windows.Point point1, System.Windows.Point point2);
new System.Windows.Rect : System.Windows.Point * System.Windows.Point -> System.Windows.Rect
Public Sub New (point1 As Point, point2 As Point)
Paramètres
- point1
- Point
Premier point que le nouveau rectangle doit contenir.
- point2
- Point
Deuxième point que le nouveau rectangle doit contenir.
Exemples
L’exemple suivant montre comment créer une Rect structure à l’aide du Rect(Point, Point) constructeur.
private Rect createRectExample3()
{
// This constructor intializes a new instance of the Rect structure that is
// exactly large enough to contain the two specified points.
Rect myRectangle = new Rect(new Point(15, 30), new Point(50,70));
// Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
return myRectangle;
}
S’applique à
Rect(Point, Size)
Initialise une nouvelle instance de la Rect structure qui a l’emplacement d’angle supérieur gauche spécifié et la largeur et la hauteur spécifiées.
public:
Rect(System::Windows::Point location, System::Windows::Size size);
public Rect(System.Windows.Point location, System.Windows.Size size);
new System.Windows.Rect : System.Windows.Point * System.Windows.Size -> System.Windows.Rect
Public Sub New (location As Point, size As Size)
Paramètres
- location
- Point
Point qui spécifie l’emplacement du coin supérieur gauche du rectangle.
Exemples
L’exemple suivant montre comment créer une Rect structure à l’aide du Rect(Point, Size) constructeur.
private Rect createRectExample4()
{
// This constructor initializes a new instance of the Rect structure that has the
// specified top-left corner location and the specified width and height (Size).
Rect myRectangle = new Rect(new Point(15, 30), new Size(35, 40));
// Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
return myRectangle;
}
S’applique à
Rect(Point, Vector)
Initialise une nouvelle instance de la Rect structure qui est exactement suffisamment grande pour contenir le point spécifié et la somme du point spécifié et du vecteur spécifié.
public:
Rect(System::Windows::Point point, System::Windows::Vector vector);
public Rect(System.Windows.Point point, System.Windows.Vector vector);
new System.Windows.Rect : System.Windows.Point * System.Windows.Vector -> System.Windows.Rect
Public Sub New (point As Point, vector As Vector)
Paramètres
- point
- Point
Le premier point que le rectangle doit contenir.
- vector
- Vector
Montant à décaler le point spécifié. Le rectangle résultant sera exactement suffisamment grand pour contenir les deux points.
Exemples
L’exemple suivant montre comment créer une Rect structure à l’aide du Rect(Point, Vector) constructeur.
private Rect createRectExample5()
{
// This constructor Intializes a new instance of the Rect structure that is exactly
// large enough to contain the specified point and the sum of the specified point
// and the specified vector.
Rect myRectangle = new Rect(new Point(15, 30), new Vector(35, 40));
// Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
return myRectangle;
}
S’applique à
Rect(Double, Double, Double, Double)
Initialise une nouvelle instance de la Rect structure qui a la coordonnée x, la coordonnée y, la largeur et la hauteur spécifiées.
public:
Rect(double x, double y, double width, double height);
public Rect(double x, double y, double width, double height);
new System.Windows.Rect : double * double * double * double -> System.Windows.Rect
Public Sub New (x As Double, y As Double, width As Double, height As Double)
Paramètres
- x
- Double
Coordonnée x du coin supérieur gauche du rectangle.
- y
- Double
Coordonnée y du coin supérieur gauche du rectangle.
- width
- Double
Largeur du rectangle.
- height
- Double
Hauteur du rectangle.
Exceptions
Remarques
L’exemple suivant montre comment créer une Rect structure à l’aide du Rect(Double, Double, Double, Double) constructeur.
private Rect createRectExample6()
{
// This constructor intializes a new instance of the Rect structure with the specified
// x- and y-coordinates and the specified width and height.
Rect myRectangle = new Rect(15, 30, 35, 40);
// Returns a rectangle with a position of 15,30, a width of 35 and height of 40.
return myRectangle;
}