/// <summary> /// Swaps the Rows in the TableModel at the specified indexes /// </summary> /// <param name="a">The index of the first Row to be swapped</param> /// <param name="b">The index of the second Row to be swapped</param> protected void Swap(int a, int b) { I3Row swap = this.TableModel.Rows[a]; this.TableModel.Rows.SetRow(a, this.TableModel.Rows[b]); this.TableModel.Rows.SetRow(b, swap); }
/// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public int Compare(object x, object y) { I3Row row1 = (I3Row)x; I3Row row2 = (I3Row)y; // check for null rows if (row1 == null && row2 == null) { return(0); } else if (row1 == null) { return(-1); } else if (row2 == null) { return(1); } if (row1.InternalIndex < row2.InternalIndex) { return(-1); } else if (row1.InternalIndex < row2.InternalIndex) { return(1); } return(0); }
/// <summary> /// 释放 /// Releases all resources used by the Cell /// </summary> public void Dispose() { if (!this.disposed) { 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; } }
/// <summary> /// Initializes a new instance of the TableModelEventArgs class with /// the specified TableModel source, start index, end index and affected Column /// </summary> /// <param name="source">The TableModel that originated the event</param> /// <param name="row">The affected Row</param> /// <param name="fromIndex">The start index of the affected Row(s)</param> /// <param name="toIndex">The end index of the affected Row(s)</param> public I3TableModelEventArgs(I3TableModel source, I3Row row, int fromIndex, int toIndex) { this.source = source; this.row = row; this.fromIndex = fromIndex; this.toIndex = toIndex; }
/// <summary> /// Initializes a new instance of the HeaderMouseEventArgs class with /// the specified source Column, Table, column index and column header bounds /// </summary> /// <param name="column">The Column that Raised the event</param> /// <param name="table">The Table the Column belongs to</param> /// <param name="index">The index of the Column</param> /// <param name="headerRect">The column header's bounding rectangle</param> public I3RowHeaderMouseEventArgs(I3Row row, I3Table table, int index, Rectangle headerRect) : base(MouseButtons.None, 0, -1, -1, 0) { this.row = row; this.table = table; this.index = index; this.headerRect = headerRect; }
/// <summary> /// Initializes a new instance of the HeaderMouseEventArgs class with /// the specified source Column, Table, column index, column header bounds /// and MouseEventArgs /// </summary> /// <param name="column">The Column that Raised the event</param> /// <param name="table">The Table the Column belongs to</param> /// <param name="index">The index of the Column</param> /// <param name="headerRect">The column header's bounding rectangle</param> /// <param name="mea">The MouseEventArgs that contains data about the /// mouse event</param> public I3RowHeaderMouseEventArgs(I3Row row, I3Table table, int index, Rectangle headerRect, MouseEventArgs mea) : base(mea.Button, mea.Clicks, mea.X, mea.Y, mea.Delta) { this.row = row; this.table = table; this.index = index; this.headerRect = headerRect; }
public I3PaintRowHeaderEventArgs(Graphics g, I3Row row, I3Table table, int columnIndex, Rectangle headerRect) : base(g, headerRect) { this._row = row; this._table = table; this._rowIndex = columnIndex; this._headerRect = headerRect; this._handled = false; }
/// <summary> /// Initializes a new instance of the RowEventArgs class with /// the specified Row source, row index, start index, end index /// and affected Cell /// </summary> /// <param name="source">The Row that originated the event</param> /// <param name="rowIndex">The index of the Row</param> /// <param name="cell">The affected Cell</param> /// <param name="cellFromIndex">The start index of the affected Cell(s)</param> /// <param name="cellToIndex">The end index of the affected Cell(s)</param> /// <param name="eventType">The type of event</param> public I3RowEventArgs(I3Row source, int rowIndex, I3Cell cell, int cellFromIndex, int cellToIndex, I3RowEventType eventType) : base() { this.source = source; this.rowIndex = rowIndex; this.cell = cell; this.cellFromIndex = cellFromIndex; this.cellToIndex = cellToIndex; this.eventType = eventType; }
/// <summary> /// Initializes a new instance of the CellCollection class /// that belongs to the specified Row /// </summary> /// <param name="owner">A Row representing the row that owns /// the Cell collection</param> public I3CellCollection(I3Row owner) : base() { if (owner == null) { throw new ArgumentNullException("owner"); } this.owner = owner; }
/// <summary> /// 计算点击哪个区域时进行编辑 /// </summary> /// <param name="checkBoxColumn"></param> /// <returns></returns> protected Rectangle CalcCheckBoxCheckRect(I3Row row, I3CheckBoxColumn checkBoxColumn) { if (checkBoxColumn.CheckBoxCheckStyle == I3CheckBoxCheckStyle.CheckInClientArea) { return(this.ClientRectangle); } else { return(this.CalcCheckBoxDisplayRect(row.Alignment, checkBoxColumn.CellAlignment, checkBoxColumn)); } }
/// <summary> /// Creates a new instance of the specified collection item type /// </summary> /// <param name="itemType">The type of item to create</param> /// <returns>A new instance of the specified object</returns> protected override object CreateInstance(Type itemType) { I3Row row = (I3Row)base.CreateInstance(itemType); // newly created items aren't added to the collection // until editing has finished. we'd like the newly // created row to show up in the table immediately // so we'll add it to the RowCollection now this.rows.Add(row); return(row); }
public virtual void CalRowHeaderNeedHeight(Graphics g, I3Row row, string text, Font font, StringFormat sf) { if (text != null && text.Length != 0) { SizeF sizeF = g.MeasureString(text, font, I3ColumnModel.MaxAutoColumnWidth_Const, sf); row.NeedHeight = sizeF.Height + 6; } else { row.NeedHeight = I3ColumnModel.MinColumnWidth_Const; } }
private void CheckCells() { I3Row row = this.previewTableModel.Rows[0]; row.Cells.Clear(); for (int i = 0; i <= this.columns.Count - 1; i++) { I3Cell cell = new I3Cell(); SetCellData(cell, this.columns[i]); row.Cells.Add(cell); } }
/// <summary> /// Destroys the specified instance of the object /// </summary> /// <param name="instance">The object to destroy</param> protected override void DestroyInstance(object instance) { if (instance != null && instance is I3Row) { I3Row row = (I3Row)instance; // the specified row is about to be destroyed so // we need to remove it from the RowCollection first this.rows.Remove(row); } base.DestroyInstance(instance); }
/// <summary> /// 对属性赋初始值 /// Initialise default values /// </summary> private void Init() { this.data = null; this.rendererData = null; this.tag = null; this.userData = null; this.row = null; this.index = -1; this.cellStyle = null; this.checkStyle = null; this.imageStyle = null; this.tooltipText = null; this.state = (byte)(STATE_EDITABLE | STATE_ENABLED); }
/// <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.cells = (I3CellCollection)value; object returnObject = base.EditValue(context, isp, value); I3Row row = (I3Row)context.Instance; if (row.TableModel != null && row.TableModel.Table != null) { row.TableModel.Table.PerformLayout(); row.TableModel.Table.Refresh(); } return(returnObject); }
/// <summary> /// 刷新前缀选择数据 /// </summary> private void RefreshPrefix() { tableModel.Rows.Clear(); if (curItem != null) { foreach (string prefix in curItem.PrefixList) { I3Row row = tableModel.Rows.Add(); I3Cell selectCell = row.Cells.Add(); if (curItem.SelectedPrefixList.Contains(prefix)) { selectCell.Checked = true; } row.Cells.Add().Data = prefix; } } }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public void AddColumns(I3ColumnModel model) { this.model = model; //this.columnTable.HeaderRenderer = model.Table.HeaderRenderer; I3CellStyle cellStyle = new I3CellStyle(); cellStyle.Padding = new I3CellPadding(0, 0, 0, 0); this.columnTable.BeginUpdate(); for (int i = 0; i < model.Columns.Count; i++) { I3Row row = new I3Row(); I3Cell cell = new I3Cell("", model.Columns[i].Visible); cell.Tag = model.Columns[i].Width; cell.CellStyle = cellStyle; row.Cells.Add(cell); cell = new I3Cell(model.Columns[i].Caption); cell.Tag = model.Columns[i].Width; cell.CellStyle = cellStyle; row.Cells.Add(cell); this.columnTable.TableModel.Rows.Add(row); } this.columnTable.SelectionChanged += new IE310.Table.Events.I3SelectionEventHandler(columnTable_SelectionChanged); this.columnTable.CellCheckChanged += new IE310.Table.Events.I3CellCheckBoxEventHandler(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.columnTable.EndUpdate(); }
/// <summary> /// Replaces the Row in the TableModel located at index a with the specified Row /// </summary> /// <param name="a">The index of the Row that will be replaced</param> /// <param name="row">The Row that will be moved to index a</param> protected void Set(int a, I3Row row) { this.TableModel.Rows.SetRow(a, row); }
/// <summary> /// Initializes a new instance of the RowEventArgs class with /// the specified Row source, row index, start index, end index /// and affected Cell /// </summary> /// <param name="source">The Row that originated the event</param> /// <param name="eventType">The type of event</param> public I3RowEventArgs(I3Row source, I3RowEventType eventType) : this(source, -1, null, -1, -1, eventType) { }
/// <summary> /// Initializes a new instance of the RowEventArgs class with /// the specified Row source, row index, start index, end index /// and affected Cell /// </summary> /// <param name="source">The Row that originated the event</param> /// <param name="cell">The affected Cell</param> /// <param name="cellFromIndex">The start index of the affected Cell(s)</param> /// <param name="cellToIndex">The end index of the affected Cell(s)</param> public I3RowEventArgs(I3Row source, I3Cell cell, int cellFromIndex, int cellToIndex) : this(source, -1, cell, cellFromIndex, cellToIndex, I3RowEventType.Unknown) { }
/// <summary> /// 设置绘制的行 /// </summary> /// <param name="column"></param> internal void SetRow(I3Row row) { this._row = row; }
private void TfrmGetSymbol_Load(object sender, EventArgs e) { busy = true; try { nameList = new ArrayList(); textList = new ArrayList(); #region 读取数据,并检查数据正确性 try { dataSet.ReadXml(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Symbol.set")); } catch (Exception ex) { I3MessageHelper.ShowError(ex.Message, ex); return; } if (dataSet.Tables.Count == 0) { return; } if (dataSet.Tables[0].Columns.Count == 0) { return; } if (dataSet.Tables[0].Rows.Count == 0) { return; } #endregion #region 写入默认数据 /*dataSet.Tables[0].Columns[0].ColumnName = "数学序号"; * dataSet.Tables[0].Columns[1].ColumnName = "数学符号"; * dataSet.Tables[0].Columns[2].ColumnName = "单位符号"; * dataSet.Tables[0].Columns[3].ColumnName = "特殊符号"; * dataSet.Tables[0].Rows[0][0] = "①②③④⑤⑥⑦⑧⑨⑩ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ"; * dataSet.Tables[0].Rows[0][1] = "×÷≠≤≥≮≯±∽≈≌⊕⊙∈∏∑∝∞∫∮"; * dataSet.Tables[0].Rows[0][2] = "℃℉﹪‰¥№㎡23㎝㎞㏎㎎㎏㏄"; * dataSet.Tables[0].Rows[0][3] = "Ф★☆○☉◎●▲△▼▽■□♀♂《》「」『』〖〗【】"; * dataSet.WriteXml(AppDomain.CurrentDomain.BaseDirectory + @"\Symbol.set");*/ #endregion #region 将数据保存到动态数组中 for (int i = 0; i < dataSet.Tables[0].Columns.Count; i++) { nameList.Add(dataSet.Tables[0].Columns[i].ColumnName); textList.Add(dataSet.Tables[0].Rows[0][i].ToString()); } cbbSymbolStyle.DataSource = nameList; #endregion #region 增加20列 for (int i = 0; i < 20; i++) { DataColumn newColumn = new DataColumn("col" + (i + 1).ToString(), typeof(string)); newDataTable.Columns.Add(newColumn); I3TextColumn textColumn = new I3TextColumn(); textColumn.Width = Convert.ToInt32(this.i3Table.Width / 20); textColumn.Sortable = false; textColumn.Editable = false; this.i3ColumnModel.Columns.Add(textColumn); } #endregion #region 得到完全字符串 string s = ""; for (int i = 0; i < textList.Count; i++) { s = s + textList[i].ToString(); } #endregion #region 得到行数,并生成DataRow int rowcount = s.Length / 20; if (s.Length % 20 > 0) { rowcount++; } for (int i = 0; i < rowcount; i++) { DataRow newRow = newDataTable.NewRow(); newDataTable.Rows.Add(newRow); } #endregion #region 给每行每列赋值 int row, col; for (int i = 0; i < s.Length; i++) { row = (i + 1) / 20; //整除 col = (i + 1) % 20; //求余 if (col == 0) { row--; col += 20; } col--; newDataTable.Rows[row].BeginEdit(); newDataTable.Rows[row][col] = I3StringUtil.SubString(s, i, 1); newDataTable.Rows[row].EndEdit(); } foreach (DataRow dataRow in newDataTable.Rows) { I3Row i3Row = new I3Row(); this.i3TableModel.Rows.Add(i3Row); foreach (DataColumn column in newDataTable.Columns) { I3Cell i3Cell = new I3Cell(dataRow[column].ToString()); i3Row.Cells.Add(i3Cell); } } #endregion this.i3TableModel.Selections.SelectCell(0, 0); } finally { busy = false; } }