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));
        }
Ejemplo n.º 2
0
 protected virtual void OnPrintCellFormatting(PrintCellFormattingEventArgs e)
 {
     if (this.PrintCellFormatting == null)
     {
         return;
     }
     this.PrintCellFormatting((object)this, e);
 }
Ejemplo n.º 3
0
 protected virtual void OnPrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
 {
     this.GridView.OnPrintCellFormatting(sender, e);
     if (this.PrintCellFormatting == null)
     {
         return;
     }
     this.PrintCellFormatting(sender, e);
 }
Ejemplo n.º 4
0
        private void DataGridViewMembers_PrintCellFormatting(object sender, Telerik.WinControls.UI.PrintCellFormattingEventArgs e)
        {
            if (e.Row is GridViewTableHeaderRowInfo)
            {
                return;
            }

            if (e.Column is GridViewDataColumn dataColumn && dataColumn.DataTypeConverter is IntToEnumConverter)
            {
                e.PrintCell.Text = dataColumn.DataTypeConverter.ConvertToString(int.Parse(e.PrintCell.Text));
            }
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
 private void renderer_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
 {
     this.OnPrintCellFormatting(sender, e);
 }
Ejemplo n.º 7
0
        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));
                    }
                }
            }
        }
 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));
             }
         }
     }
 }