internal int Draw(Graphics gr, TemplateSet ts, int xOffset, int width, int yOffset, int ymax, int iRow, int iRowOffset, ref bool resetScrollbar) { int num = yOffset + iRowOffset; int count = base.List.Count; this.LastDrawnRowOffset = num; this.LastDrawnRow = iRow; while (this.LastDrawnRow < count) { Row row = null; if ((this.LastDrawnRow >= 0) && (this.LastDrawnRow < base.InnerList.Count)) { row = base.InnerList[this.LastDrawnRow] as Row; } if (row != null) { RowTemplate template = row.GetTemplate(ts); int height = 0; int num4 = -1; if (template.CustomizeCells(row)) { num4 = template.GetHeight(row); row.ResetCachedBounds(); } height = template.GetHeight(row); if ((num4 >= 0) && (height != num4)) { resetScrollbar = true; } if ((num + height) >= 0) { template.Draw(gr, xOffset, num, row, width, height); } this.LastDrawnRowOffset = num; num += height; if (this.m_bDrawGrid) { gr.DrawLine(this.m_penBorder, xOffset, num, width + xOffset, num); num++; } if (num > ymax) { return(num); } } this.LastDrawnRow++; } this.LastDrawnRowOffset = num; return(num); }
internal int GetHeight(int i, TemplateSet ts) { if ((i < 0) || (i >= base.List.Count)) { return(0); } Row row = (Row)base.InnerList[i]; RowTemplate template = ts[row.CurrentTemplateIndex]; if (template == null) { template = RowTemplate.Default; } if (this.m_bDrawGrid) { return(template.GetHeight(row) + 1); } return(template.GetHeight(row)); }
internal int CalculateRowsHeight() { int num = 0; foreach (Row row in base.List) { RowTemplate template = this.GetTemplate(row); num += template.GetHeight(row); if (this.m_bDrawGrid) { num++; } } return(num); }
internal Point GetRowClick(int iRow, int iRowOffset, int pos_x, int pos_y, out int yOffset) { yOffset = 0; int num = iRowOffset; if (num <= pos_y) { for (int i = iRow; i < base.List.Count; i++) { Row r = (Row)base.InnerList[i]; RowTemplate template = this.GetTemplate(r); int height = template.GetHeight(r); yOffset = num; num += this.m_bDrawGrid ? (height + 1) : height; if (num > pos_y) { return(new Point(i, template.GetCellClick(pos_x, pos_y - yOffset, r))); } } } return(new Point(-1, -1)); }
internal void OnRowChange(object sender, RowEventArgsType e, object oParam) { object obj2 = oParam; Row r = (Row)sender; RowTemplate template = this.GetTemplate(r); switch (e) { case RowEventArgsType.Selection: { if (!r.Selected) { if (this.m_cSelected > 0) { this.m_cSelected--; } if (r != this.m_rActive) { break; } this.m_rActive = null; return; } bool flag = (bool)oParam; if (this.m_rActive != null) { this.m_rActive.ChangeSelection(this.Parent.MultiSelect, false, false); } if (!flag) { this.m_cSelected = this.m_pParent.MultiSelect ? (this.m_cSelected + 1) : 1; } this.m_rActive = r; return; } case RowEventArgsType.TemplateIndex: { int num = 0; num = -this.GetTemplate(r, (int)oParam).GetHeight(r); r.ResetCachedBounds(); num += template.GetHeight(r); this.OnChanged(base.List.IndexOf(r), GridEventArgsType.Resize, num); return; } default: if (template.AutoHeight) { int actualHeight = r.ActualHeight; r.ResetCachedBounds(); int height = template.GetHeight(r); if (height != actualHeight) { this.OnChanged(base.List.IndexOf(r), GridEventArgsType.Resize, height - actualHeight); return; } } this.Changed(base.List.IndexOf(sender), GridEventArgsType.RowChange, obj2); break; } }
private int CustomizeHeaderFooter(RowTemplate t, Row r, ref bool bResetScrollbar) { int num2 = -1; if (t.CustomizeCells(r)) { num2 = t.GetHeight(r); r.ResetCachedBounds(); } int height = t.GetHeight(r); if ((num2 >= 0) && (height != num2)) { bResetScrollbar = true; } return height; }