/// <summary> /// Initializes a new instance of the ColumnCollectionEditor class /// using the specified collection type /// </summary> /// <param name="type">The type of the collection for this editor to edit</param> public I3ColumnCollectionEditor(Type type) : base(type) { this.columns = null; this.previewColumnModel = new I3ColumnModel(); this.previewColumnModel.Columns.Add(new I3TextColumn("Column", 116)); this.previewTableModel = new I3TableModel(); this.previewTableModel.Rows.Add(new I3Row()); //I3Cell cell = new I3Cell(); //cell.Editable = false; //cell.ToolTipText = "This is a Cell ToolTip"; //this.previewTableModel.Rows[0].Cells.Add(cell); this.previewTableModel.DefaultRowHeight = 20; this.previewTable = new I3Table(); this.previewTable.EnableColumnHeaderContextMenu = false; this.previewTable.Preview = true; this.previewTable.Size = new Size(120, 274); this.previewTable.Location = new Point(0, 24); this.previewTable.GridLines = I3GridLines.Both; this.previewTable.TabStop = false; this.previewTable.EnableToolTips = true; this.previewTable.ColumnModel = this.previewColumnModel; this.previewTable.TableModel = this.previewTableModel; this.previewLabel = new Label(); this.previewLabel.Name = "previewLabel"; this.previewLabel.Text = "нц└└:"; this.previewLabel.Size = new Size(140, 16); this.previewLabel.Location = new Point(0, 8); }
/// <summary> /// Initializes a new instance of the ColumnModelEventArgs class with /// the specified ColumnModel source, start index, end index and affected Column /// </summary> /// <param name="source">The ColumnModel that originated the event</param> /// <param name="column">The affected Column</param> /// <param name="fromIndex">The start index of the affected Column(s)</param> /// <param name="toIndex">The end index of the affected Column(s)</param> public I3ColumnModelEventArgs(I3ColumnModel source, I3Column column, int fromIndex, int toIndex) : base() { this.source = source; this.column = column; this.fromIndex = fromIndex; this.toIndex = toIndex; }
/// <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> /// Initializes a new instance of the HeaderContextMenu class with /// no menu items specified /// </summary> public I3ColumnHeaderContextMenu() : base() { this.model = null; this.enabled = true; this.moreMenuItem = new MenuItem("More...", new EventHandler(moreMenuItem_Click)); this.separator = new MenuItem("-"); }
/// <summary> /// Edits the value of the specified object using the specified /// service provider and context /// </summary> /// <param name="context">An ITypeDescriptorContext that can be /// used to gain additional context information</param> /// <param name="isp">A service provider object through which /// editing services can be obtained</param> /// <param name="value">The object to edit the value of</param> /// <returns>The new value of the object. If the value of the /// object has not changed, this should return the same object /// it was passed</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider isp, object value) { this.columns = (I3ColumnCollection)value; // for some reason (might be beacause Column is an // abstract class) the table doesn't get redrawn // when a columns property changes, but we can get // around that by subscribing to the columns // PropertyChange event and passing the message on // to the table ourselves. we need to do this for // all the existing columns in the collection for (int i = 0; i < this.columns.Count; i++) { this.columns[i].PropertyChanged += new I3ColumnEventHandler(column_PropertyChanged); } I3ColumnModel model = (I3ColumnModel)context.Instance; I3Table oldTable = model.Table; if (oldTable != null) { oldTable.ColumnModel = null; } this.previewTable.ColumnModel = model; this.CheckCells(); object returnObject = base.EditValue(context, isp, value); if (oldTable != null) { oldTable.ColumnModel = model; } this.previewTable.ColumnModel = null; if (model.Table != null) { model.Table.PerformLayout(); model.Table.Refresh(); } return(returnObject); }