/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public void AddColumns(ColumnModel model) { this.model = model; CellStyle cellStyle = new CellStyle(); cellStyle.Padding = new CellPadding(6, 0, 0, 0); this.columnTable.BeginUpdate(); for (int i=0; i<model.Columns.Count; i++) { Row row = new Row(); Cell cell = new Cell(model.Columns[i].Text, model.Columns[i].Visible); cell.Tag = model.Columns[i].Width; cell.CellStyle = cellStyle; row.Cells.Add(cell); this.columnTable.TableModel.Rows.Add(row); } this.columnTable.SelectionChanged += new XPTable.Events.SelectionEventHandler(columnTable_SelectionChanged); this.columnTable.CellCheckChanged += new XPTable.Events.CellCheckBoxEventHandler(columnTable_CellCheckChanged); if (this.columnTable.VScroll) { this.columnTable.ColumnModel.Columns[0].Width -= SystemInformation.VerticalScrollBarWidth; } if (this.columnTable.TableModel.Rows.Count > 0) { this.columnTable.TableModel.Selections.SelectCell(0, 0); this.showButton.Enabled = !this.model.Columns[0].Visible; this.hideButton.Enabled = this.model.Columns[0].Visible; this.widthTextBox.Text = this.model.Columns[0].Width.ToString(); } this.columnTable.EndUpdate(); }
/// <summary> /// Initializes a new instance of the Cell class with the specified text, /// check value and CellStyle /// </summary> /// <param name="text">The text displayed in the Cell</param> /// <param name="check">Specifies whether the Cell is Checked</param> /// <param name="cellStyle">A CellStyle that specifies the visual appearance /// of the Cell</param> public Cell(string text, bool check, CellStyle cellStyle) { this.Init(); this.text = text; this.Checked = check; this.cellStyle = cellStyle; }
/// <summary> /// Initializes a new instance of the Cell class with the specified text, /// Image and CellStyle /// </summary> /// <param name="text">The text displayed in the Cell</param> /// <param name="image">The Image displayed in the Cell</param> /// <param name="cellStyle">A CellStyle that specifies the visual appearance /// of the Cell</param> public Cell(string text, Image image, CellStyle cellStyle) { this.Init(); this.text = text; this.Image = image; this.cellStyle = cellStyle; }
/// <summary> /// Initializes a new instance of the Cell class with the specified text, /// object and CellStyle /// </summary> /// <param name="text">The text displayed in the Cell</param> /// <param name="value">The object displayed in the Cell</param> /// <param name="cellStyle">A CellStyle that specifies the visual appearance /// of the Cell</param> public Cell(string text, object value, CellStyle cellStyle) { this.Init(); this.text = text; this.data = value; this.cellStyle = cellStyle; }
/// <summary> /// Initializes a new instance of the Cell class with the specified text /// and CellStyle /// </summary> /// <param name="value">The object displayed in the Cell</param> /// <param name="cellStyle">A CellStyle that specifies the visual appearance /// of the Cell</param> public Cell(object value, CellStyle cellStyle) { this.Init(); this.data = value; this.cellStyle = cellStyle; }
/// <summary> /// Initializes a new instance of the Cell class with the specified text /// and CellStyle /// </summary> /// <param name="text">The text displayed in the Cell</param> /// <param name="cellStyle">A CellStyle that specifies the visual appearance /// of the Cell</param> public Cell(string text, CellStyle cellStyle) { this.Init(); this.text = text; this.cellStyle = cellStyle; }
/// <summary> /// Initialise default values /// </summary> private void Init() { this.text = null; this.data = null; this.rendererData = null; this.tag = null; this.row = null; this.index = -1; this.cellStyle = null; this.checkStyle = null; this.imageStyle = null; this.tooltipText = null; this.colspan = 1; this.state = (byte)(STATE_EDITABLE | STATE_ENABLED); }
/// <summary> /// Releases all resources used by the Cell /// </summary> public void Dispose() { if (!this.disposed) { this.text = null; this.data = null; this.tag = null; this.rendererData = null; if (this.row != null) { this.row.Cells.Remove(this); } this.row = null; this.index = -1; this.cellStyle = null; this.checkStyle = null; this.imageStyle = null; this.tooltipText = null; this.state = (byte) 0; this.disposed = true; } }