コード例 #1
0
 protected virtual Size GetRowSize(GridViewRowInfo row, HtmlViewRowLayout rowLayout)
 {
     if (this.rowSize == Size.Empty)
     {
         int width1 = 0;
         int height = rowLayout.GetRowHeight(row) + this.GridView.TableElement.RowSpacing;
         foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns)
         {
             if (!(renderColumn is GridViewRowHeaderColumn) && !(renderColumn is GridViewIndentColumn))
             {
                 HtmlViewCellArrangeInfo arrangeInfo = rowLayout.GetArrangeInfo(renderColumn);
                 if (arrangeInfo != null)
                 {
                     int width2 = (int)arrangeInfo.Bounds.Width;
                     if ((double)width1 < (double)arrangeInfo.Bounds.X + (double)width2)
                     {
                         width1 = (int)arrangeInfo.Bounds.X + width2;
                     }
                 }
             }
         }
         this.rowSize = new Size(width1, height);
     }
     return(this.rowSize);
 }
コード例 #2
0
 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));
             }
         }
     }
 }