Esempio n. 1
0
        public void creaFormaColor()
        {
            int filas     = 5;
            int col       = 8;
            int distancia = 10;

            FormaColor fc;
            int        x   = 10;
            int        y   = 10;
            int        ind = 0;

            for (int i = 0; i < filas; i++)
            {
                for (int j = 0; j < col; j++)
                {
                    fc           = new FormaColor();
                    fc.Location  = new Point(x, y);
                    fc.Forma     = eForma.Elipse;
                    fc.ForeColor = Color.CadetBlue;
                    fc.Size      = new Size(40, 30);
                    fc.Texto     = "Acierto";
                    fc.Tag       = ind;
                    //fc.MouseClick += new System.Windows.Forms.MouseEventHandler(this.click);
                    //fc.Click += new System.EventHandler(this.click);
                    this.panel1.Controls.Add(fc);
                    x += 40 + distancia;
                    ind++;
                }
                y += 30 + distancia;
                x  = 10;
            }
        }
Esempio n. 2
0
        private void click(object sender, EventArgs e)
        {
            FormaColor fc = (FormaColor)sender;

            //Rectangle rect = new Rectangle(fc.Location.X, fc.Location.Y, fc.Location.X + fc.Width, fc.Location.Y + fc.Height);
            //if (rect.Contains(e.))
            {
                if (indices.Contains(Convert.ToInt32(fc.Tag)))
                {
                    //MessageBox.Show(fc.Tag.ToString());
                    indices.Remove(Convert.ToInt32(fc.Tag));
                    fc.Forma = eForma.Texto;

                    if (indices.Count == 0)
                    {
                        timer1.Enabled    = false;
                        btnInicio.Enabled = true;
                        Form2 f2 = new Form2();

                        if (f2.ShowDialog() == DialogResult.OK)
                        {
                            string nombre = f2.txtNombre.Text;
                            string edad   = f2.cbEdad.SelectedItem.ToString();
                            toolTip1.SetToolTip(btnInicio, nombre + " " + edad);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 private void btnInicio_Click(object sender, EventArgs e)
 {
     foreach (Control c in this.panel1.Controls)
     {
         FormaColor co = (FormaColor)c;
         if (co.Forma == eForma.Texto)
         {
             co.Size  = new Size(40, 30);
             co.Forma = eForma.Elipse;
             //co.ForeColor = Color.CadetBlue;
             co.Click -= new System.EventHandler(this.click);
         }
     }
     this.panel1.Enabled = true;
     numIndices();
     decimas = 0;
     cont    = 0;
     inicio  = true;
 }