Example #1
0
        private void cbRepOseg_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (validarCantidadSeriesRepSeg())
            {
                int    cantidadSeries  = Convert.ToInt32(tbCantidadSeries.Text);
                String textPlaceHolder = cbRepOseg.SelectedItem.ToString() == "Repeticiones" ? "Cantidad de repeticiones" : "Cantidad de segundos";

                for (int i = 0; i < cantidadSeries; i++)
                {
                    string nombreTextBox = "textRepOSeg";
                    textRepOSeg = inicializarTextBox(textPlaceHolder, nombreTextBox, i);

                    nombreTextBox = "textPeso";
                    textPeso      = inicializarTextBox("Cantidad de peso (kg.)", nombreTextBox, i);

                    panelSubirRutina.Controls.Add(textRepOSeg);
                    panelSubirRutina.Controls.Add(textPeso);
                    posicionY += 25;
                }

                posicionarBotones();
                cbRepOseg.Enabled = false;
            }
            else if (cbRepOseg.SelectedIndex == -1)
            {
                return;
            }
            else
            {
                MessageBox.Show("¡No te olvides que la cantidad de series realizadas debe ser un número!");
                tbCantidadSeries.Clear();
                tbCantidadSeries.Focus();
            }
        }
Example #2
0
        private TextBoxPersonalizado inicializarTextBox(String placeHolder, String nombre, int Indice)
        {
            TextBoxPersonalizado txt = new TextBoxPersonalizado()
            {
                Name      = nombre + Indice,
                BackColor = Color.FromArgb(23, 21, 32),
                ForeColor = Color.White,
                Width     = 150,
                Text      = placeHolder,
                TextAlign = HorizontalAlignment.Center,
                Anchor    = (AnchorStyles.Left | AnchorStyles.Right),
                Location  = new Point(0, posicionY)
            };

            if (!textBoxIzquierda)
            {
                txt.Anchor       = AnchorStyles.Left;
                textBoxIzquierda = true;
            }
            else
            {
                txt.Anchor       = AnchorStyles.Right;
                textBoxIzquierda = false;
            }

            return(txt);
        }