1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
class Carre
{
// Champs privés de la classe.
int hauteur;
int largeur;
// Constructeur de la classe.
public Carre(int uneHauteur, int uneLargeur)
{
this.hauteur = uneHauteur;
this.largeur = uneLargeur;
}
// Méthode permettant de créer une PictureBox.
public PictureBox fctAddPB(int unePositionX, int unePositionY)
{
PictureBox box = new PictureBox;
box.Size = new Size(hauteur, largeur);
box.Location = new Point(unePositionX, unePositionY)
box.BorderStyle = BorderStyle.Fixed3D;
box.BackColor = System.Drawing.Color.White;
return box;
}
} |