コード例 #1
0
        private RectangleF ArrangeCellCore(
            GridViewColumn columnInfo,
            GridViewRowInfo rowInfo,
            RectangleF clientRect)
        {
            HtmlViewCellArrangeInfo arrangeInfo = this.GetArrangeInfo(columnInfo);

            if (arrangeInfo == null)
            {
                return(RectangleF.Empty);
            }
            RectangleF bounds = arrangeInfo.Bounds;

            if ((double)clientRect.Height != (double)this.DesiredSize.Height && !(rowInfo is GridViewTableHeaderRowInfo))
            {
                if (arrangeInfo.Cell == null)
                {
                    bounds.Height = clientRect.Height;
                }
                else
                {
                    int rowIndex = arrangeInfo.Cell.RowIndex;
                    int num      = rowIndex * this.Owner.CellSpacing;
                    bounds.Y      = (float)((int)Math.Ceiling((double)this.TranslateY(bounds.Y - (float)num, clientRect.Height)) + num);
                    bounds.Height = (float)(int)Math.Ceiling((double)this.TranslateY(bounds.Height, clientRect.Height));
                    if (rowIndex + arrangeInfo.Cell.RowSpan == this.RowTemplate.Rows.Count && (double)bounds.Bottom != (double)clientRect.Height)
                    {
                        bounds.Height = clientRect.Height - bounds.Y;
                    }
                }
            }
            return(bounds);
        }
コード例 #2
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);
 }
コード例 #3
0
        public override int GetColumnOffset(GridViewColumn column)
        {
            HtmlViewCellArrangeInfo arrangeInfo = this.GetArrangeInfo(column);

            if (arrangeInfo == null)
            {
                return(0);
            }
            return((int)arrangeInfo.Bounds.X);
        }
コード例 #4
0
        public override SizeF MeasureRow(SizeF availableSize)
        {
            if (this.cachedAvailableSize == availableSize || this.Owner == null)
            {
                return(this.desiredSize);
            }
            this.cachedAvailableSize = availableSize;
            this.MinimizeRowTemplate();
            this.CalculateColumnWidths(availableSize);
            int num1 = 0;

            for (int index = 0; index < this.columnWidths.Count; ++index)
            {
                num1 += this.columnWidths[index];
            }
            int width1 = num1 + (this.columnWidths.Count - 1) * this.Owner.CellSpacing;
            int num2   = 0;

            for (int index = 0; index < this.RowTemplate.Rows.Count; ++index)
            {
                num2 += this.RowTemplate.Rows[index].Height;
            }
            this.rowsHeight = num2;
            int num3 = num2 + (this.RowTemplate.Rows.Count - 1) * this.Owner.CellSpacing;

            this.fixedWidth = 0;
            foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>) this.RenderColumns)
            {
                HtmlViewCellArrangeInfo arrangeInfo = this.GetArrangeInfo(renderColumn);
                if (this.systemColumns.Contains(renderColumn))
                {
                    int columnWidth = this.GetColumnWidth(renderColumn);
                    arrangeInfo.Bounds = new RectangleF((float)this.fixedWidth, 0.0f, (float)columnWidth, (float)num3);
                    this.fixedWidth   += columnWidth + this.Owner.CellSpacing;
                }
                else
                {
                    arrangeInfo.Bounds = this.GetCellBounds(arrangeInfo.Cell);
                }
                float width2 = Math.Max(arrangeInfo.Bounds.Width, (float)renderColumn.MinWidth);
                if (renderColumn.MaxWidth > 0)
                {
                    width2 = Math.Min(arrangeInfo.Bounds.Width, (float)renderColumn.MaxWidth);
                }
                arrangeInfo.Bounds = new RectangleF(arrangeInfo.Bounds.X, arrangeInfo.Bounds.Y, width2, arrangeInfo.Bounds.Height);
            }
            this.desiredSize = new SizeF((float)(width1 + this.fixedWidth), (float)num3);
            this.Owner.ColumnScroller.ClientSize = new SizeF(availableSize.Width - (float)this.fixedWidth, availableSize.Height);
            this.Owner.ColumnScroller.UpdateScrollRange(width1, true);
            return(this.desiredSize);
        }
コード例 #5
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));
             }
         }
     }
 }