Exemplo n.º 1
0
        /// <summary>
        /// Añadir nuevo campo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BttnAddField_Click(object sender, EventArgs e)
        {
            int indx;

            FieldsTypeSelect fts = new FieldsTypeSelect();
            var result           = fts.ShowDialog();

            if (result == DialogResult.OK)
            {
                StackedPanel.SuspendLayout();

                FieldPanel p = CreateField(fts.Type);

                StackedPanel.Controls.Add(p);

                if (FocusedControl != null)
                {
                    indx = StackedPanel.Controls.IndexOf(FocusedControl);
                    StackedPanel.Controls.SetChildIndex(p, indx + 1);
                }

                StackedPanel.ResumeLayout();
                StackedPanel.ScrollControlIntoView(p);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Crear los campos por defecto al iniciar el programa.
        /// </summary>
        private void CreateDefaultFields()
        {
            StackedPanel.SuspendLayout();

            StackedPanel.Controls.AddRange(new Control[] {
                CreateField(FieldTypes.Types[EFieldName.Numero_Fila]),
                CreateField(FieldTypes.Types[EFieldName.Nombre]),
                CreateField(FieldTypes.Types[EFieldName.Fecha]),
                CreateField(FieldTypes.Types[EFieldName.Nombre_Completo]),
            });
            StackedPanel.ResumeLayout();
        }
Exemplo n.º 3
0
 private void MoveField(int pos)
 {
     try
     {
         if (FocusedControl != null)
         {
             StackedPanel.Controls.SetChildIndex(
                 FocusedControl,
                 StackedPanel.Controls.GetChildIndex(FocusedControl) + pos
                 );
             StackedPanel.ScrollControlIntoView(FocusedControl);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Cambiar tipo de campo del campo seleccionado.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ChangeField(object sender, EventArgs e)
        {
            int        indx;
            FieldPanel prevField = ((sender as Button).Parent as Panel).Parent as FieldPanel;

            FieldsTypeSelect fts = new FieldsTypeSelect();
            var result           = fts.ShowDialog();

            if (result == DialogResult.OK && prevField.FieldType.BName != fts.Type.BName)
            {
                StackedPanel.SuspendLayout();

                indx = StackedPanel.Controls.IndexOf(prevField);

                FieldPanel p = CreateField(fts.Type, prevField.TBFieldName.Text);

                StackedPanel.Controls.RemoveAt(indx);
                StackedPanel.Controls.Add(p);
                StackedPanel.Controls.SetChildIndex(p, indx);
                StackedPanel.ResumeLayout();
            }
        }