protected virtual void PrintRowWideCell( GridViewRowInfo row, ColumnGroupRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { Size rowSize = this.GetRowSize(row, rowLayout); Rectangle rectangle = new Rectangle(new Point(currentX, currentY), rowSize); CellPrintElement printCell = new CellPrintElement(); if (row is GridViewGroupRowInfo) { printCell = this.CreateGroupCellPrintElement(row as GridViewGroupRowInfo); if (printCell.Font != settings.GroupRowFont) { if (settings.GroupRowFont != null) { printCell.Font = settings.GroupRowFont; } else { settings.GroupRowFont = printCell.Font; } } } printCell.TextPadding = this.GridView.PrintStyle.CellPadding; printCell.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, (GridViewColumn)null, printCell); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, (GridViewColumn)null, rectangle)); }
protected virtual void PrintRow( GridViewRowInfo row, TableViewRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { this.PrintRow(row, rowLayout, settings, currentX, currentY, graphics, Rectangle.Empty); }
protected virtual void PrintRowWideCell( GridViewRowInfo row, TableViewRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { int num1 = row.Group != null ? row.Group.Level + 1 : 0; int num2 = row.HierarchyLevel + 1 - num1; Size rowSize = this.GetRowSize(row, rowLayout); Rectangle rectangle = new Rectangle(currentX + num2 * settings.HierarchyIndent, currentY, rowSize.Width - num2 * settings.HierarchyIndent, rowSize.Height); CellPrintElement printCell = new CellPrintElement(); if (row is GridViewGroupRowInfo) { if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { rectangle.Width -= this.PrintPages[this.CurrentPrintPage].Count - 1; } printCell = this.CreateGroupCellPrintElement(row as GridViewGroupRowInfo); if (printCell.Font != settings.GroupRowFont) { if (settings.GroupRowFont != null) { printCell.Font = settings.GroupRowFont; } else { settings.GroupRowFont = printCell.Font; } } } printCell.TextPadding = this.GridView.PrintStyle.CellPadding; printCell.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, (GridViewColumn)null, printCell); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, (GridViewColumn)null, rectangle)); }
public GridPrintStyle(RadGridView grid) { this.grid = grid; this.printSettings = new GridPrintSettings(); this.Initialize(); }
public GridPrintStyle() { this.printSettings = new GridPrintSettings(); }
public override void DrawPage( PrintGridTraverser traverser, Rectangle drawArea, Graphics graphics, GridPrintSettings settings, int pageNumber) { bool flag1 = this.currentPage != pageNumber; int height = drawArea.Height; int x = drawArea.X; int y = drawArea.Y; TableViewRowLayout rowLayout = this.GetRowLayout((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, settings.FitWidthMode, settings.HierarchyIndent, drawArea); rowLayout.IgnoreColumnVisibility = settings.PrintHiddenColumns; int num1 = 0; foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { if (renderColumn is GridViewRowHeaderColumn || renderColumn is GridViewIndentColumn) { num1 += rowLayout.GetColumnWidth(renderColumn); } } int num2 = (int)rowLayout.DesiredSize.Width - num1; if (settings.FitWidthMode == PrintFitWidthMode.NoFitCentered) { x += (drawArea.Width - num2) / 2; } if ((this.GridView.ShowColumnHeaders && this.firstPage && pageNumber == 1 || settings.PrintHeaderOnEachPage) && !settings.PrintHierarchy) { this.PrintRow((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, rowLayout, settings, x, y, graphics, drawArea); int num3 = this.GetDataRowHeight((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, (TableViewRowLayoutBase)rowLayout) + this.GridView.TableElement.RowSpacing; y += num3; height -= num3; } this.firstPage = false; int num4 = y; GridViewRowInfo row = (GridViewRowInfo)null; if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { row = traverser.Current; } bool flag2 = true; while (traverser.MoveNext()) { if (traverser.Current is GridViewDataRowInfo || traverser.Current is GridViewGroupRowInfo || traverser.Current is GridViewSummaryRowInfo || traverser.Current is GridViewTableHeaderRowInfo && settings.PrintHierarchy) { GridViewHierarchyRowInfo current = traverser.Current as GridViewHierarchyRowInfo; if (current != null && current.Views.Count > 0) { switch (settings.ChildViewPrintMode) { case ChildViewPrintMode.PrintFirstView: current.ActiveView = current.Views[0]; break; case ChildViewPrintMode.SelectViewToPrint: ChildViewPrintingEventArgs e = new ChildViewPrintingEventArgs(current.Views.IndexOf(current.ActiveView), current); this.OnChildViewPrinting(e); current.ActiveView = current.Views[e.ActiveViewIndex]; break; } } rowLayout = this.GetRowLayout(traverser.Current, settings.FitWidthMode, settings.HierarchyIndent, drawArea); int num3 = !(traverser.Current is GridViewGroupRowInfo) ? this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) : this.GetRowSize(traverser.Current, rowLayout).Height; if ((y + num3 >= drawArea.Bottom || num4 + num3 >= drawArea.Bottom) && !flag2) { traverser.MovePrevious(); num4 = y; bool flag3 = this.currentPage != pageNumber; ++this.currentPage; if (!flag3) { break; } } else { if (traverser.Current is GridViewGroupRowInfo) { if (settings.PrintGrouping) { if (this.currentPage == pageNumber) { this.PrintRowWideCell(traverser.Current, rowLayout, settings, x, y, graphics); y += num3 + this.GridView.TableElement.RowSpacing; } else { num4 += num3 + this.GridView.TableElement.RowSpacing; } } } else if (!(traverser.Current is GridViewSummaryRowInfo) || settings.PrintSummaries) { if (this.currentPage == pageNumber) { this.PrintRow(traverser.Current, rowLayout, settings, x, y, graphics, drawArea); y += num3 + this.GridView.TableElement.RowSpacing; } else { num4 += num3 + this.GridView.TableElement.RowSpacing; } } else { continue; } if (height < num3 && flag2) { ++this.currentPage; break; } flag2 = false; } } } if (this.PrintPages.Count <= 0 || settings.PrintHierarchy) { return; } if (y + this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) < drawArea.Bottom || num4 + this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) < drawArea.Bottom) { ++this.currentPage; } ++this.CurrentPrintPage; this.CurrentPrintPage %= this.PrintPages.Count; if (this.CurrentPrintPage <= 0) { return; } if (row == null) { traverser.Reset(); } else { traverser.GoToRow(row); } }
protected virtual void PrintRow( GridViewRowInfo row, TableViewRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics, Rectangle drawArea) { List <GridViewColumn> gridViewColumnList = new List <GridViewColumn>(); float num1 = 1f; if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { float num2 = 0.0f; foreach (GridViewColumn column in (List <GridViewColumn>) this.PrintPages[this.CurrentPrintPage]) { if (!column.IsGrouped) { num2 += (float)rowLayout.GetColumnWidth(column); gridViewColumnList.Add(column); } } num1 = (float)drawArea.Width / num2; } else { foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { gridViewColumnList.Add(renderColumn); } } int num3 = row.Group != null ? row.Group.Level + 1 : 0; if (this.GridView.RightToLeft != RightToLeft.Yes) { currentX += (row.HierarchyLevel - num3) * settings.HierarchyIndent; } else { currentX -= (row.HierarchyLevel - num3) * settings.HierarchyIndent; } float num4 = 0.0f; float num5 = 0.0f; float num6 = 0.0f; bool flag = true; foreach (GridViewColumn gridViewColumn in gridViewColumnList) { if (!(gridViewColumn is GridViewRowHeaderColumn) && !(gridViewColumn is GridViewIndentColumn) && gridViewColumn.PinPosition == PinnedColumnPosition.Left) { num5 = (float)rowLayout.Owner.CellSpacing; num6 = (float)rowLayout.Owner.CellSpacing; break; } } foreach (GridViewColumn column in gridViewColumnList) { if (!(column is GridViewRowHeaderColumn) && !(column is GridViewIndentColumn)) { TableViewCellArrangeInfo arrangeInfo = rowLayout.LayoutImpl.GetArrangeInfo(column); if (arrangeInfo != null) { float x = arrangeInfo.OffsetX < 0 ? 0.0f : (float)arrangeInfo.OffsetX; float y = (float)(int)arrangeInfo.Bounds.Y; float width = (float)arrangeInfo.CachedWidth; float height = (float)(this.GetDataRowHeight(row, (TableViewRowLayoutBase)rowLayout) + this.GridView.TableElement.RowSpacing); int num2 = flag ? 0 : rowLayout.Owner.CellSpacing; flag = false; if ((double)y + (double)height > (double)drawArea.Bottom) { height = (float)drawArea.Height - y; } if (column.PinPosition == PinnedColumnPosition.Left) { num5 += width + (float)num2; num6 += width + (float)num2; } else if (column.PinPosition == PinnedColumnPosition.None) { num6 += width + (float)num2; x += num5; } else { x += num6; } if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { x = num4; width = (float)Math.Ceiling((double)(width * num1)); } if (this.GridView.RightToLeft == RightToLeft.Yes) { x = (float)drawArea.Width - width - x; } RectangleF rectangleF = new RectangleF(x, y, width, height); rectangleF.Offset((float)currentX, (float)currentY); CellPrintElement cellPrintElement; if (row is GridViewTableHeaderRowInfo) { GridViewCellInfo cell = this.GridView.MasterView.TableHeaderRow.Cells[column.Name]; cellPrintElement = this.CreateHeaderCellPrintElement(column); if (cellPrintElement.Font != settings.HeaderCellFont) { if (settings.HeaderCellFont != null) { cellPrintElement.Font = settings.HeaderCellFont; } else { settings.HeaderCellFont = cellPrintElement.Font; } } } else if (row is GridViewSummaryRowInfo) { cellPrintElement = this.CreateSummaryCellPrintElement((row as GridViewSummaryRowInfo).Cells[column.Name]); if (cellPrintElement.Font != settings.SummaryCellFont) { if (settings.SummaryCellFont != null) { cellPrintElement.Font = settings.SummaryCellFont; } else { settings.SummaryCellFont = cellPrintElement.Font; } } } else { cellPrintElement = this.CreateDataCellPrintElement(row.Cells[column.Name]); if (cellPrintElement.Font != settings.CellFont) { if (settings.CellFont != null) { cellPrintElement.Font = settings.CellFont; } else { settings.CellFont = cellPrintElement.Font; } } } if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { num4 += width; } cellPrintElement.TextPadding = this.GridView.PrintStyle.CellPadding; cellPrintElement.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; Rectangle rectangle = new Rectangle((int)rectangleF.X, (int)rectangleF.Y, (int)rectangleF.Width, (int)rectangleF.Height); PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, column, cellPrintElement); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, column, rectangle)); } } } }
protected virtual void PrintRow( GridViewRowInfo row, ColumnGroupRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { float num1 = 0.0f; float num2 = 0.0f; foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { if (!(renderColumn is GridViewRowHeaderColumn) && !(renderColumn is GridViewIndentColumn)) { float rowHeight = (float)rowLayout.GetRowHeight(row); RectangleF correctedColumnBounds = rowLayout.GetCorrectedColumnBounds(row, renderColumn, this.GridView.RightToLeft == RightToLeft.Yes, new RectangleF(0.0f, 0.0f, rowLayout.DesiredSize.Width, rowHeight)); if (!(correctedColumnBounds == RectangleF.Empty)) { if (renderColumn.PinPosition == PinnedColumnPosition.Left) { if ((double)num1 < (double)correctedColumnBounds.Right + (double)rowLayout.Owner.CellSpacing) { num1 = correctedColumnBounds.Right + (float)rowLayout.Owner.CellSpacing; num2 = num1; } } else if (renderColumn.PinPosition == PinnedColumnPosition.None) { if ((double)num2 < (double)num1 + (double)correctedColumnBounds.Right + (double)rowLayout.Owner.CellSpacing) { num2 = num1 + correctedColumnBounds.Right + (float)rowLayout.Owner.CellSpacing; } correctedColumnBounds.X += num1; } else { correctedColumnBounds.X += num2; } correctedColumnBounds.Offset((float)currentX, (float)currentY); CellPrintElement cellPrintElement; if (row is GridViewTableHeaderRowInfo) { GridViewCellInfo cell = this.GridView.MasterView.TableHeaderRow.Cells[renderColumn.Name]; cellPrintElement = this.CreateHeaderCellPrintElement(renderColumn); if (cellPrintElement.Font != settings.HeaderCellFont) { if (settings.HeaderCellFont != null) { cellPrintElement.Font = settings.HeaderCellFont; } else { settings.HeaderCellFont = cellPrintElement.Font; } } } else if (row is GridViewSummaryRowInfo) { GridViewCellInfo cell = (row as GridViewSummaryRowInfo).Cells[renderColumn.Name]; if (cell != null) { cellPrintElement = this.CreateSummaryCellPrintElement(cell); if (cellPrintElement.Font != settings.SummaryCellFont) { if (settings.SummaryCellFont != null) { cellPrintElement.Font = settings.SummaryCellFont; } else { settings.SummaryCellFont = cellPrintElement.Font; } } } else { continue; } } else { GridViewCellInfo cell = row.Cells[renderColumn.Name]; if (cell != null) { if (renderColumn is GridViewImageColumn) { cellPrintElement = this.CreateImageCellPrintElement(cell); } else { cellPrintElement = this.CreateDataCellPrintElement(cell); if (cellPrintElement.Font != settings.CellFont) { if (settings.CellFont != null) { cellPrintElement.Font = settings.CellFont; } else { settings.CellFont = cellPrintElement.Font; } } } } else { continue; } } cellPrintElement.TextPadding = this.GridView.PrintStyle.CellPadding; cellPrintElement.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; Rectangle rectangle = new Rectangle((int)correctedColumnBounds.X, (int)correctedColumnBounds.Y, (int)correctedColumnBounds.Width, (int)correctedColumnBounds.Height); PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, renderColumn, cellPrintElement); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, renderColumn, rectangle)); } } } }
public override void DrawPage( PrintGridTraverser traverser, Rectangle drawArea, Graphics graphics, GridPrintSettings settings, int pageNumber) { bool flag1 = this.currentPage != pageNumber; int x = drawArea.X; int y = drawArea.Y; int height = drawArea.Height; ColumnGroupRowLayout rowLayout = new ColumnGroupRowLayout(this.GridView.ViewDefinition as ColumnGroupsViewDefinition); rowLayout.IgnoreColumnVisibility = settings.PrintHiddenColumns; rowLayout.Context = GridLayoutContext.Printer; rowLayout.Initialize(this.GridView.TableElement); int num1 = 0; foreach (GridViewColumn systemColumn in rowLayout.SystemColumns) { num1 += rowLayout.GetColumnWidth(systemColumn); } if (settings.FitWidthMode == PrintFitWidthMode.FitPageWidth) { this.GridView.BeginUpdate(); GridViewAutoSizeColumnsMode autoSizeColumnsMode = rowLayout.ViewTemplate.AutoSizeColumnsMode; rowLayout.ViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; rowLayout.MeasureRow(new SizeF((float)(drawArea.Width + num1), (float)drawArea.Height)); rowLayout.ViewTemplate.AutoSizeColumnsMode = autoSizeColumnsMode; this.GridView.EndUpdate(false); } else { this.GridView.BeginUpdate(); GridViewAutoSizeColumnsMode autoSizeColumnsMode = rowLayout.ViewTemplate.AutoSizeColumnsMode; rowLayout.ViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; rowLayout.MeasureRow(new SizeF((float)this.GridView.Width, (float)this.GridView.Height)); rowLayout.ViewTemplate.AutoSizeColumnsMode = autoSizeColumnsMode; this.GridView.EndUpdate(false); } int num2 = (int)rowLayout.DesiredSize.Width - num1; if (settings.FitWidthMode == PrintFitWidthMode.NoFitCentered) { x += (drawArea.Width - num2) / 2; } if (this.firstPage && pageNumber == 1 || settings.PrintHeaderOnEachPage) { this.firstPage = false; this.PrintRow((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, rowLayout, settings, x, y, graphics); int rowHeight = rowLayout.GetRowHeight((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow); y += rowHeight; height -= rowHeight; } int num3 = y; bool flag2 = true; while (traverser.MoveNext()) { int num4 = rowLayout.GetRowHeight(traverser.Current) + this.GridView.TableElement.RowSpacing; if (traverser.Current is GridViewGroupRowInfo || traverser.Current is GridViewDataRowInfo || traverser.Current is GridViewSummaryRowInfo) { if ((y + num4 >= drawArea.Bottom || num3 + num4 >= drawArea.Bottom) && !flag2) { traverser.MovePrevious(); num3 = y; bool flag3 = this.currentPage != pageNumber; ++this.currentPage; if (!flag3) { break; } } else { if (traverser.Current is GridViewGroupRowInfo) { if (settings.PrintGrouping) { if (this.currentPage == pageNumber) { this.PrintRowWideCell(traverser.Current, rowLayout, settings, x, y, graphics); y += num4; } else { num3 += num4; } } } else if (!(traverser.Current is GridViewSummaryRowInfo) || settings.PrintSummaries) { if (this.currentPage == pageNumber) { this.PrintRow(traverser.Current, rowLayout, settings, x, y, graphics); y += num4; } else { num3 += num4; } } else { continue; } if (height < num4 && flag2) { ++this.currentPage; break; } flag2 = false; } } } }
public abstract void DrawPage( PrintGridTraverser traverser, Rectangle drawArea, Graphics graphics, GridPrintSettings settings, int pageNumber);
protected virtual void PrintRow( GridViewRowInfo row, HtmlViewRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { if (!(renderColumn is GridViewRowHeaderColumn) && !(renderColumn is GridViewIndentColumn)) { HtmlViewCellArrangeInfo arrangeInfo = rowLayout.GetArrangeInfo(renderColumn); if (arrangeInfo != null) { RectangleF bounds = arrangeInfo.Bounds; bounds.Offset((float)currentX, (float)currentY); CellPrintElement cellPrintElement; if (row is GridViewTableHeaderRowInfo) { GridViewCellInfo cell = this.GridView.MasterView.TableHeaderRow.Cells[renderColumn.Name]; cellPrintElement = this.CreateHeaderCellPrintElement(renderColumn); if (cellPrintElement.Font != settings.HeaderCellFont) { if (settings.HeaderCellFont != null) { cellPrintElement.Font = settings.HeaderCellFont; } else { settings.HeaderCellFont = cellPrintElement.Font; } } } else if (row is GridViewSummaryRowInfo) { cellPrintElement = this.CreateSummaryCellPrintElement((row as GridViewSummaryRowInfo).Cells[renderColumn.Name]); if (cellPrintElement.Font != settings.SummaryCellFont) { if (settings.SummaryCellFont != null) { cellPrintElement.Font = settings.SummaryCellFont; } else { settings.SummaryCellFont = cellPrintElement.Font; } } } else { GridViewCellInfo cell = row.Cells[renderColumn.Name]; if (renderColumn is GridViewImageColumn) { cellPrintElement = this.CreateImageCellPrintElement(cell); } else { cellPrintElement = this.CreateDataCellPrintElement(cell); if (cellPrintElement.Font != settings.CellFont) { if (settings.CellFont != null) { cellPrintElement.Font = settings.CellFont; } else { settings.CellFont = cellPrintElement.Font; } } } } cellPrintElement.TextPadding = this.GridView.PrintStyle.CellPadding; cellPrintElement.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; Rectangle rectangle = new Rectangle((int)bounds.X, (int)bounds.Y, (int)bounds.Width, (int)bounds.Height); PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, renderColumn, cellPrintElement); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, renderColumn, rectangle)); } } } }