Exemplo 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;
            }
        }
Exemplo n.º 2
0
 private void Bt_Add_Cercle_Click(object sender, EventArgs e)
 {
     if (Tb_Rayon_Cercle.Text != "" && Tb_X_Cercle.Text != "" && Tb_Y_Cercle.Text != "")
     {
         Forme cercle = new Cercle(Convert.ToInt32(Tb_Rayon_Cercle.Text), Convert.ToInt32(Tb_X_Cercle.Text), Convert.ToInt32(Tb_Y_Cercle.Text));
         Tb_Rayon_Cercle.Text = "";
         Tb_X_Cercle.Text     = "";
         Tb_Y_Cercle.Text     = "";
         LesForme.Add(cercle);
         Cercle f1 = (Cercle)LesForme[LesForme.Count - 1];
         Conn.AddCercle(LesForme[LesForme.Count - 1].Id, f1.getR(), LesForme[LesForme.Count - 1].getposi().getX(), LesForme[LesForme.Count - 1].getposi().getY());
         ActualisationDgv();
     }
     else
     {
         MessageBox.Show("Un champ n'a pas etais saisie");
     }
 }
Exemplo n.º 3
0
        public void dessiner(Forme f, Control c)
        {
            Cercle   f1 = (Cercle)f;
            Graphics formGraphics;

            formGraphics = c.CreateGraphics();

            SolidBrush myBrush = new SolidBrush(Color.Blue);

            formGraphics.FillEllipse(myBrush, new System.Drawing.Rectangle(f.getposi().getY(), f.getposi().getX(), f1.getR(), f1.getR()));
            myBrush.Dispose();
        }