/// <summary> /// Displays the shortcut menu at the specified position /// </summary> /// <param name="control">A Control object that specifies the control /// with which this shortcut menu is associated</param> /// <param name="pos">A Point object that specifies the coordinates at /// which to display the menu. These coordinates are specified relative /// to the client coordinates of the control specified in the control /// parameter</param> public new void Show(Control control, Point pos) { if (control == null) { throw new ArgumentNullException("control", "control cannot be null"); } if (!(control is I3Table)) { throw new ArgumentException("control must be of type Table", "control"); } if (((I3Table)control).ColumnModel == null) { throw new InvalidOperationException("The specified Table does not have an associated ColumnModel"); } // this.model = ((I3Table)control).ColumnModel; // this.MenuItems.Clear(); //base.Show(control, pos); I3ShowColumnsDialog scd = new I3ShowColumnsDialog(); scd.AddColumns(this.model); Screen screen = Screen.FromPoint(pos); if (screen == null) { screen = Screen.PrimaryScreen; } //Table table = (Table)control; //Form form = table.FindForm(); //Point point = table.PointToScreen(new Point(table.TableModel.RowHeaderWidth + 20, -20)); //scd.Left = point.X; //scd.Top = point.Y; //scd.Top = Convert.ToInt32(screen.WorkingArea.Height / 2 - scd.Height / 2); if (this.model.Table != null) { this.model.Table.BeginUpdate(); } try { scd.ShowDialog(this.SourceControl); this.model.Columns.RecalcWidthCache(); } finally { ColumnDisplayHelper.ReSort(model); if (this.model.Table != null) { this.model.Table.EndUpdate(); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void moreMenuItem_Click(object sender, EventArgs e) { I3ShowColumnsDialog scd = new I3ShowColumnsDialog(); scd.AddColumns(this.model); if (this.model.Table != null) { this.model.Table.BeginUpdate(); } try { scd.ShowDialog(this.SourceControl); this.model.Columns.RecalcWidthCache(); } finally { ColumnDisplayHelper.ReSort(model); if (this.model.Table != null) { this.model.Table.EndUpdate(); } } }