예제 #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;
            }
        }
예제 #2
0
 private void BT_Add_carre_Click(object sender, EventArgs e)
 {
     if (Tb_Cote_carre.Text != "" && Tb_X_carre.Text != "" && Tb_Y_carre.Text != "")
     {
         Forme Carre = new Carre(Convert.ToInt32(Tb_Cote_carre.Text), Convert.ToInt32(Tb_X_carre.Text), Convert.ToInt32(Tb_Y_carre.Text));
         Tb_Cote_carre.Text = "";
         Tb_X_carre.Text    = "";
         Tb_Y_carre.Text    = "";
         LesForme.Add(Carre);
         Carre f1 = (Carre)LesForme[LesForme.Count - 1];
         Conn.AddCarre(LesForme[LesForme.Count - 1].Id, f1.getC(), LesForme[LesForme.Count - 1].getposi().getX(), LesForme[LesForme.Count - 1].getposi().getY());
         ActualisationDgv();
     }
     else
     {
         MessageBox.Show("Un champ n'a pas etais saisie");
     }
 }
예제 #3
0
        public void dessiner(Forme f, Control c)
        {
            Carre f1 = (Carre)f;

            System.Drawing.Graphics formGraphics;
            formGraphics = c.CreateGraphics();

            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Fuchsia);
            formGraphics.FillRectangle(myBrush, new System.Drawing.Rectangle(f.getposi().getY(), f.getposi().getX(), f1.getC(), f1.getC()));
            myBrush.Dispose();
        }