private void addButton_Click(object sender, EventArgs e)
 {
     int count;
     if (this.selectedColumns.SelectedIndex == -1)
     {
         count = this.selectedColumns.Items.Count;
     }
     else
     {
         count = this.selectedColumns.SelectedIndex + 1;
     }
     if (this.addColumnDialog == null)
     {
         this.addColumnDialog = new DataGridViewAddColumnDialog(this.columnsPrivateCopy, this.liveDataGridView);
         this.addColumnDialog.StartPosition = FormStartPosition.CenterParent;
     }
     this.addColumnDialog.Start(count, false);
     this.addColumnDialog.ShowDialog(this);
 }
Пример #2
0
        public void OnAddColumn(object sender, EventArgs e)
        {
            DesignerTransaction         transaction = (base.Component.Site.GetService(typeof(IDesignerHost)) as IDesignerHost).CreateTransaction(System.Design.SR.GetString("DataGridViewAddColumnTransactionString"));
            DialogResult                cancel      = DialogResult.Cancel;
            DataGridViewAddColumnDialog dialog      = new DataGridViewAddColumnDialog(((DataGridView)base.Component).Columns, (DataGridView)base.Component);

            dialog.Start(((DataGridView)base.Component).Columns.Count, true);
            try
            {
                cancel = this.ShowDialog(dialog);
            }
            finally
            {
                if (cancel == DialogResult.OK)
                {
                    transaction.Commit();
                }
                else
                {
                    transaction.Cancel();
                }
            }
        }
 public void OnAddColumn(object sender, EventArgs e)
 {
     DesignerTransaction transaction = (base.Component.Site.GetService(typeof(IDesignerHost)) as IDesignerHost).CreateTransaction(System.Design.SR.GetString("DataGridViewAddColumnTransactionString"));
     DialogResult cancel = DialogResult.Cancel;
     DataGridViewAddColumnDialog dialog = new DataGridViewAddColumnDialog(((DataGridView) base.Component).Columns, (DataGridView) base.Component);
     dialog.Start(((DataGridView) base.Component).Columns.Count, true);
     try
     {
         cancel = this.ShowDialog(dialog);
     }
     finally
     {
         if (cancel == DialogResult.OK)
         {
             transaction.Commit();
         }
         else
         {
             transaction.Cancel();
         }
     }
 }