public void InsertRow(int index, object[] cells) { if (cells == null || cells.Length <= 0) { throw new ArgumentException("输入数组参数不能为空."); } ScrollingTextRow row = NewRow(index, cells.Length); int offset = IsAutoLineNumber ? 1 : 0; for (int i = 0; i < cells.Length; i++) { row.Cells[i + offset].Text = cells[i].ToString(); row.Cells[i + offset].TextAlignment = this.ColumnHeaders[i + offset].RowCellAlignment; } }
public ScrollingTextRow NewRow(int index, int column_number) { ScrollingTextRow row = new ScrollingTextRow(); if (IsAutoLineNumber) { row.Cells.Add(new ScrollingTextCell()); } row.Cells[0].TextAlignment = this.ColumnHeaders[0].RowCellAlignment; for (int i = 0; i < column_number; i++) { row.Cells.Add(new ScrollingTextCell()); } this.Rows.Insert(index, row); return(row); }
private void DrawRows(Graphics g) { int n = this.LastBlankRow;//最后空n行 try { if (this.ShowRowYOffset <= -this.RowHeight) { this.ShowRowIndex++; this.ShowRowYOffset = 0f; } if (this.ShowRowIndex >= this.Rows.Count + n) { this.ShowRowIndex = 0; } float y = this.ShowColumnHeader ? this.ColumnHeaderHeight : 0; y += this.ShowRowYOffset; int i; for (i = this.ShowRowIndex; i < this.Rows.Count; i++) { ScrollingTextRow row = this.Rows[i]; row.Draw(g, this.Font, this.ForeColor, this.ColumnHeaders, y, this.RowHeight, i + 1); y += this.RowHeight; if (y >= this.Height) { break; } } if (this.ShowRowIndex > 0) { //隐含y<this.Height //填补,开头至ShowRowIndex的行 //补上2行空白后才开始绘制 int nn = this.Rows.Count + n - this.ShowRowIndex; y += this.RowHeight * Math.Min(n, nn); if (y < this.Height) { for (i = 0; i < this.ShowRowIndex; i++) { ScrollingTextRow row = this.Rows[i]; row.Draw(g, this.Font, this.ForeColor, this.ColumnHeaders, y, this.RowHeight, i + 1); y += this.RowHeight; if (y >= this.Height) { break; } } if (i == this.ShowRowIndex) { //未满屏,重置 Reset(); } } } } catch { } }
public void DeleteRow(ScrollingTextRow row) { this.Rows.Remove(row); }
public ScrollingTextRow NewRow(int index, int column_number) { ScrollingTextRow row = new ScrollingTextRow(); if (IsAutoLineNumber) row.Cells.Add(new ScrollingTextCell()); row.Cells[0].TextAlignment = this.ColumnHeaders[0].RowCellAlignment; for (int i = 0; i < column_number; i++) row.Cells.Add(new ScrollingTextCell()); this.Rows.Insert(index, row); return row; }