Esempio n. 1
0
        private void dessiner()
        {
            this.P_Quest.CreateGraphics().Clear(Color.Gainsboro);
            switch (FormeRandom[numQuestion - 1].Type)
            {
            case "Carre":
                Carre f1 = (Carre)FormeRandom[numQuestion - 1];
                INFO_Forme.Text = "Le carre a pour cote " + f1.getC() + " pixel .";
                DessinateurCarre dc = new DessinateurCarre();
                dc.dessiner(FormeRandom[numQuestion - 1], this.P_Quest);
                break;

            case "Cercle":
                Cercle f2 = (Cercle)FormeRandom[numQuestion - 1];
                INFO_Forme.Text = "Le cercle a pour Rayon " + f2.getR() + " pixel .";
                DessinateurCercle dc2 = new DessinateurCercle();
                dc2.dessiner(FormeRandom[numQuestion - 1], this.P_Quest);
                break;

            case "Rectangle":
                librairie.Rectangle f3 = (librairie.Rectangle)FormeRandom[numQuestion - 1];
                INFO_Forme.Text = "Le Rectangle a pour Largeur " + f3.getlarg() + " pixel et de Longeur " + f3.getlong() + " pixel .";
                DessinateurRectangle dc3 = new DessinateurRectangle();
                dc3.dessiner(FormeRandom[numQuestion - 1], this.P_Quest);
                break;
            }
        }
Esempio n. 2
0
 private void Bt_Add_Rectangle_Click(object sender, EventArgs e)
 {
     if (Tb_larg_Rectangle.Text != "" && Tb_long_Rectangle.Text != "" && Tb_X_Rectangle.Text != "" && Tb_Y_Rectangle.Text != "")
     {
         Forme Rectangle = new librairie.Rectangle(Convert.ToInt32(Tb_larg_Rectangle.Text), Convert.ToInt32(Tb_long_Rectangle.Text), Convert.ToInt32(Tb_X_Rectangle.Text), Convert.ToInt32(Tb_Y_Rectangle.Text));
         Tb_larg_Rectangle.Text = "";
         Tb_long_Rectangle.Text = "";
         Tb_X_Rectangle.Text    = "";
         Tb_Y_Rectangle.Text    = "";
         LesForme.Add(Rectangle);
         librairie.Rectangle f1 = (librairie.Rectangle)LesForme[LesForme.Count - 1];
         Conn.AddRectangle(LesForme[LesForme.Count - 1].Id, f1.getlong(), f1.getlarg(), LesForme[LesForme.Count - 1].getposi().getX(), LesForme[LesForme.Count - 1].getposi().getY());
         ActualisationDgv();
     }
     else
     {
         MessageBox.Show("Un champ n'a pas etais saisie");
     }
 }