Example #1
0
 private void Form1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         Circulo C = new Circulo(e.X, e.Y);
         C.Dibujar(this);
         figuras.Add(C);
     }
     else if (e.Button == MouseButtons.Right)
     {
         Rectangulo R = new Rectangulo(e.X, e.Y);
         R.Dibujar(this);
         figuras.Add(R);
     }
 }
Example #2
0
 private void Form1_MouseClick(object sender, MouseEventArgs e)
 {
     if (MouseButtons.Right == e.Button)
     {
         contextMenuStrip1.Show(this, e.X, e.Y);
     }
     if (MouseButtons.Left == e.Button && circuloToolStripMenuItem.Checked == true)
     {
         Circulo c = new Circulo(e.X, e.Y);
         c.Dibuja(this);
         figuras.Add(c);
     }
     else if (MouseButtons.Left == e.Button && rectanguloToolStripMenuItem.Checked == true)
     {
         Rectangulo r = new Rectangulo(e.X, e.Y);
         r.Dibuja(this);
         figuras.Add(r);
     }
 }
Example #3
0
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            if (MouseButtons.Right == e.Button)
            {
                contextMenuStrip1.Show(this, e.X, e.Y);
            }
            else if (MouseButtons.Left == e.Button)
            {
                if (figura_actual == TipoFigura.Circulo)
                {
                    Circulo c = new Circulo(e.X, e.Y, this.color);
                    c.Draw(this);
                    rectangulos.Add(c);
                }
                else if (figura_actual == TipoFigura.Rectangulo)
                {
                    Rectangulo r = new Rectangulo(e.X, e.Y, this.color);
                    r.Draw(this);
                    rectangulos.Add(r);
                }

                else if (figura_actual == TipoFigura.Recta)
                {
                    Recta r = new Recta(e.X, e.Y, this.color);
                    r.Draw(this);
                    rectangulos.Add(r);
                }

                else if (figura_actual == TipoFigura.Triangulo)
                {
                    Triangulo r = new Triangulo(e.X, e.Y, this.color);
                    r.Draw(this);
                    rectangulos.Add(r);
                }
            }
        }
Example #4
0
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left) //Dibujar Rectangulo al dar click izquierdo
            {
                Graphics   g = CreateGraphics();
                Rectangulo r = new Rectangulo(e.X, e.Y);
                r.Dibuja(g);
                figuras.Add(r);

                if (this.azulToolStripMenuItem.Checked == true)
                {
                    r.ColoreaAzul(g);
                }
                else if (this.verdeToolStripMenuItem.Checked == true)
                {
                    r.ColoreaVerde(g);
                }
                else if (this.rojoToolStripMenuItem.Checked == true)
                {
                    r.ColoreaRojo(g);
                }
                else if (this.amarilloToolStripMenuItem.Checked == true)
                {
                    r.ColoreaAmarillo(g);
                }
            }
            else if (e.Button == MouseButtons.Right) //Dibujar Elipse al dar click Derecho
            {
                Graphics g    = CreateGraphics();
                Elipse   elip = new Elipse(e.X, e.Y);
                elip.Dibuja(g);
                figuras.Add(elip);

                if (this.azulToolStripMenuItem.Checked == true)
                {
                    elip.ColoreaAzul(g);
                }
                else if (this.verdeToolStripMenuItem.Checked == true)
                {
                    elip.ColoreaVerde(g);
                }
                else if (this.rojoToolStripMenuItem.Checked == true)
                {
                    elip.ColoreaRojo(g);
                }
                else if (this.amarilloToolStripMenuItem.Checked == true)
                {
                    elip.ColoreaAmarillo(g);
                }
            }

            else //Mostrar menú al dar botón de enmedio
            {
                contextMenuStrip1.Show(this, e.X, e.Y);
            }

            //Contador de Figuras
            int contador = figuras.Count();

            lblFiguras.Text = "Numero de dibujos:" + contador;
        }