Beispiel #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);
            }
        }
Beispiel #2
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());
     }
 }