/// <summary> /// 重置列头布局 /// </summary> public virtual void resetHeaderLayout() { int bandsSize = m_bands.size(); FCRect bounds = Bounds; int left = bounds.left; int width = Width; if (bandsSize == 0) { int scrollH = 0; FCHScrollBar hScrollBar = Grid.HScrollBar; if (hScrollBar != null && hScrollBar.Visible) { scrollH = -hScrollBar.Pos; } int columnsSize = m_columns.size(); for (int i = 0; i < columnsSize; i++) { FCBandedFCGridColumn column = m_columns.get(i); if (column.Visible) { int columnWidth = column.Width; if (i == columnsSize - 1 || left + columnWidth > width + bounds.left) { columnWidth = width + bounds.left - left; } FCRect cellRect = new FCRect(left, bounds.bottom, left + columnWidth, bounds.bottom + column.Height); column.Bounds = cellRect; cellRect.left -= scrollH; cellRect.right -= scrollH; column.HeaderRect = cellRect; left += columnWidth; } } } else { for (int i = 0; i < bandsSize; i++) { FCGridBand band = m_bands.get(i); if (band.Visible) { int bandWidth = band.Width; if (i == bandsSize - 1 || left + bandWidth > width + bounds.left) { bandWidth = width + bounds.left - left; } FCRect cellRect = new FCRect(left, bounds.bottom, left + bandWidth, bounds.bottom + band.Height); band.Bounds = cellRect; band.resetHeaderLayout(); left += bandWidth; } } } }
/// <summary> /// 重置列头布局 /// </summary> public override void resetHeaderLayout() { int left = 0, top = 0, scrollH = 0; FCHScrollBar hScrollBar = HScrollBar; if (hScrollBar != null && hScrollBar.Visible) { scrollH = -hScrollBar.Pos; } int headerHeight = HeaderVisible ? HeaderHeight : 0; int horizontalOffset = HorizontalOffset; int verticalOffset = VerticalOffset; int bandsSize = m_bands.size(); for (int i = 0; i < bandsSize; i++) { FCGridBand band = m_bands.get(i); if (band.Visible) { int bandHeight = headerHeight < band.Height ? headerHeight : band.Height; FCRect bandRect = new FCRect(left + horizontalOffset, top + verticalOffset, left + horizontalOffset + band.Width, top + bandHeight + verticalOffset); bool hasFrozenColumn = false; ArrayList <FCBandedFCGridColumn> childColumns = band.getAllChildColumns(); int childColumnsSize = childColumns.size(); for (int j = 0; j < childColumnsSize; j++) { if (childColumns.get(j).Frozen) { hasFrozenColumn = true; break; } } if (!hasFrozenColumn) { bandRect.left += scrollH; bandRect.right += scrollH; } band.Bounds = bandRect; band.resetHeaderLayout(); left += band.Width; } } }