コード例 #1
0
        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));
        }
コード例 #2
0
        protected virtual void SetColumnWidth(GridViewColumn column, float desiredWidth)
        {
            if (column == null)
            {
                return;
            }
            if (column.MaxWidth > 0 && (double)desiredWidth > (double)column.MaxWidth)
            {
                desiredWidth = (float)column.MaxWidth;
            }
            if ((double)desiredWidth < (double)column.MinWidth)
            {
                desiredWidth = (float)column.MinWidth;
            }
            if (!this.updateRowsHeight)
            {
                this.updateRowsHeight = (double)column.Width != (double)desiredWidth && column.WrapText && this.tableElement.GridViewElement.AutoSizeRows;
            }
            TableViewRowLayout   rowLayout1 = this.TableElement.ViewElement.RowLayout as TableViewRowLayout;
            ColumnGroupRowLayout rowLayout2 = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (column.OwnerTemplate.AutoSizeColumnsMode == GridViewAutoSizeColumnsMode.Fill && rowLayout1 != null)
            {
                rowLayout1.StretchColumn(column, (int)desiredWidth);
            }
            else if (rowLayout2 != null)
            {
                rowLayout2.SetBestFitWidth(column, desiredWidth);
            }
            else
            {
                column.Width = (int)Math.Round((double)desiredWidth / (double)column.DpiScale.Width);
            }
        }
コード例 #3
0
        protected override bool IsItemVisible(GridViewColumn data)
        {
            if (!this.ScrollColumns)
            {
                return(true);
            }
            ColumnGroupRowLayout rowLayout = this.context.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (rowLayout == null)
            {
                return(true);
            }
            if (data.IsPinned && this.ScrollColumns)
            {
                return(false);
            }
            int num = 0;

            if (this.Context.TableElement.ColumnScroller.ScrollMode == ItemScrollerScrollModes.Discrete)
            {
                for (int index = 0; index < this.Context.TableElement.ColumnScroller.Scrollbar.Value; ++index)
                {
                    num += this.Context.TableElement.ColumnScroller.GetScrollHeight(rowLayout.ScrollableColumns[index]);
                }
            }
            else
            {
                num = this.context.TableElement.HScrollBar.Value;
            }
            RectangleF viewRect = new RectangleF((float)num, 0.0f, this.availableSize.Width, this.availableSize.Height);

            return(rowLayout.IsColumnVisible(data, viewRect));
        }
コード例 #4
0
        protected override SizeF EndMeasure()
        {
            SizeF empty = SizeF.Empty;
            PinnedColumnTraverser dataProvider = this.DataProvider as PinnedColumnTraverser;
            SizeF sizeF;

            if (!this.ScrollColumns && dataProvider != null)
            {
                sizeF = this.Context.TableElement.ViewElement.RowLayout.MeasurePinnedColumns(dataProvider);
            }
            else
            {
                sizeF       = this.Context.TableElement.ViewElement.RowLayout.DesiredSize;
                sizeF.Width = Math.Min(this.availableSize.Width, sizeF.Width);
            }
            if (!this.Context.TableElement.GridViewElement.AutoSizeRows)
            {
                return(new SizeF(sizeF.Width, this.availableSize.Height));
            }
            ColumnGroupRowLayout rowLayout = this.context.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (rowLayout != null)
            {
                this.desiredSize.Height = rowLayout.MeasureAutoSizeRow(this.Children);
            }
            return(new SizeF(sizeF.Width, this.desiredSize.Height));
        }
コード例 #5
0
 protected virtual Size GetRowSize(GridViewRowInfo row, ColumnGroupRowLayout 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))
             {
                 ColumnGroupsCellArrangeInfo columnData = rowLayout.GetColumnData(renderColumn);
                 if (columnData != null)
                 {
                     int width2 = (int)columnData.Bounds.Width;
                     if ((double)width1 < (double)columnData.Bounds.X + (double)width2)
                     {
                         width1 = (int)columnData.Bounds.X + width2;
                     }
                 }
             }
         }
         this.rowSize = new Size(width1, height);
     }
     return(this.rowSize);
 }
コード例 #6
0
        public override SizeF GetElementSize(GridViewColumn item)
        {
            float width = (float)item.Width;

            if (item is GridViewRowHeaderColumn)
            {
                width = (float)this.rowView.RowHeaderColumnWidth;
            }
            else if (item is GridViewIndentColumn)
            {
                width = (float)this.rowView.GroupIndent;
            }
            if ((double)width < 0.0)
            {
                width = this.DefaultElementSize.Width;
            }
            if (item is GridViewGroupColumn)
            {
                ColumnGroupRowLayout rowLayout = this.rowView.ViewElement.RowLayout as ColumnGroupRowLayout;
                if (rowLayout != null)
                {
                    ColumnGroupsCellArrangeInfo columnData = rowLayout.GetColumnData(item);
                    if (columnData != null)
                    {
                        width = columnData.Bounds.Width;
                    }
                }
            }
            return(new SizeF(width, 0.0f));
        }
コード例 #7
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF           clientRect           = new RectangleF(PointF.Empty, finalSize);
            IGridRowLayout       rowLayout            = this.context.TableElement.ViewElement.RowLayout;
            ColumnGroupRowLayout columnGroupRowLayout = rowLayout as ColumnGroupRowLayout;

            if (columnGroupRowLayout != null && this.Context.TableElement.GridViewElement.AutoSizeRows)
            {
                columnGroupRowLayout.BeginAutoSizeRowArrange(this.Children);
            }
            foreach (RadElement child in this.Children)
            {
                RectangleF arrangeRect = rowLayout.ArrangeCell(clientRect, child as GridCellElement);
                if (this.ScrollColumns)
                {
                    int discreteScrollOffset = this.GetDiscreteScrollOffset();
                    if (this.RightToLeft)
                    {
                        arrangeRect.X += (float)discreteScrollOffset;
                    }
                    else
                    {
                        arrangeRect.X -= (float)discreteScrollOffset;
                    }
                }
                this.ArrangeElementCore(child, finalSize, arrangeRect);
            }
            if (columnGroupRowLayout != null && this.Context.TableElement.GridViewElement.AutoSizeRows)
            {
                columnGroupRowLayout.EndAutoSizeRowArrange();
            }
            return(finalSize);
        }
コード例 #8
0
        protected override void DropInColumnGroupsView(
            ColumnGroupsViewDefinition view,
            GridViewColumn column,
            RadPosition dropPosition)
        {
            GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;

            if (gridViewDataColumn != null)
            {
                if (this.ViewTemplate.AllowColumnReorder && this.GridViewGroupColumn.Group.Groups.Count == 0)
                {
                    GridViewColumnGroupRow row = this.FindRow(view.ColumnGroups, (GridViewColumn)gridViewDataColumn);
                    if (this.GridViewGroupColumn.Group != null && this.GridViewGroupColumn.Group.Rows.Count == 0 && (dropPosition & RadPosition.Bottom) != RadPosition.None)
                    {
                        this.GridViewGroupColumn.Group.Rows.Add(new GridViewColumnGroupRow());
                    }
                    if (this.GridViewGroupColumn.Group != null && this.GridViewGroupColumn.Group.Rows.Count > 0)
                    {
                        if (row != null)
                        {
                            row.ColumnNames.Remove(gridViewDataColumn.Name);
                            if (row.ColumnNames.Count == 0)
                            {
                                this.FindGroup(view.ColumnGroups, row)?.Rows.Remove(row);
                            }
                        }
                        if ((dropPosition & RadPosition.Left) != RadPosition.None)
                        {
                            this.GridViewGroupColumn.Group.Rows[0].ColumnNames.Insert(0, gridViewDataColumn.Name);
                        }
                        else
                        {
                            this.GridViewGroupColumn.Group.Rows[0].ColumnNames.Add(gridViewDataColumn.Name);
                        }
                    }
                }
                if (!column.IsVisible && this.GridViewGroupColumn.Group.Groups.Count == 0)
                {
                    column.IsVisible = true;
                }
                else
                {
                    ColumnGroupRowLayout rowLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;
                    rowLayout.InvalidateLayout();
                    rowLayout.InvalidateRenderColumns();
                    this.TableElement.ViewElement.UpdateRows(true);
                }
            }
            else
            {
                if (!(column is GridViewGroupColumn))
                {
                    return;
                }
                this.DropColumnGroup(view, ((GridViewGroupColumn)column).Group, dropPosition);
            }
        }
コード例 #9
0
        protected virtual void BestFitGroupColumns(BestFitColumnMode?mode)
        {
            ColumnGroupRowLayout rowLayout = this.tableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (rowLayout == null)
            {
                return;
            }
            foreach (GridViewGroupColumn groupColumn in this.GetGroupColumns(rowLayout))
            {
                this.BestFitGroupColumn(groupColumn, false, mode);
            }
        }
コード例 #10
0
        private List <GridViewGroupColumn> GetGroupColumns(
            ColumnGroupRowLayout columGroupRowLayout)
        {
            List <GridViewGroupColumn> gridViewGroupColumnList = new List <GridViewGroupColumn>();

            foreach (GridViewColumn scrollableColumn in (IEnumerable <GridViewColumn>)columGroupRowLayout.ScrollableColumns)
            {
                GridViewGroupColumn gridViewGroupColumn = scrollableColumn as GridViewGroupColumn;
                if (gridViewGroupColumn != null)
                {
                    gridViewGroupColumnList.Add(gridViewGroupColumn);
                }
            }
            return(gridViewGroupColumnList);
        }
コード例 #11
0
        private void DropColumnGroup(
            ColumnGroupsViewDefinition view,
            GridViewColumnGroup group,
            RadPosition dropPosition)
        {
            ColumnGroupCollection groupCollection1 = this.FindGroupCollection(view, this.GridViewGroupColumn.Group);
            ColumnGroupCollection groupCollection2 = this.FindGroupCollection(view, group);
            int index = groupCollection1.IndexOf(this.GridViewGroupColumn.Group);

            if (groupCollection1 == groupCollection2 && groupCollection2 != null && groupCollection2.IndexOf(group) < index)
            {
                --index;
            }
            if (group.Parent != null)
            {
                group.Parent.Groups.Remove(group);
            }
            else
            {
                view.ColumnGroups.Remove(group);
            }
            if ((dropPosition & RadPosition.Bottom) != RadPosition.None && this.GridViewGroupColumn.Group.Rows.Count == 0)
            {
                this.GridViewGroupColumn.Group.Groups.Add(group);
            }
            else if ((dropPosition & RadPosition.Left) != RadPosition.None)
            {
                groupCollection1.Insert(index, group);
            }
            else if (index < groupCollection1.Count - 1)
            {
                groupCollection1.Remove(group);
                groupCollection1.Insert(index + 1, group);
            }
            else
            {
                groupCollection1.Add(group);
            }
            if (!group.IsVisible)
            {
                group.IsVisible = true;
            }
            ColumnGroupRowLayout rowLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            rowLayout.InvalidateLayout();
            rowLayout.InvalidateRenderColumns();
            this.TableElement.ViewElement.UpdateRows(true);
        }
コード例 #12
0
        private void BestFitGroupColumn(
            GridViewGroupColumn column,
            bool bestFitChildColumns,
            BestFitColumnMode?mode)
        {
            GridTableHeaderRowElement headerRowElement = this.GetHeaderRowElement();
            IVirtualizedElementProvider <GridViewColumn> elementProvider = this.tableElement.ColumnScroller.ElementProvider;
            ColumnGroupRowLayout rowLayout = this.tableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (rowLayout == null || headerRowElement == null)
            {
                return;
            }
            GridColumnGroupCellElement element = elementProvider.GetElement((GridViewColumn)column, (object)headerRowElement) as GridColumnGroupCellElement;

            if (element == null || !element.CanBestFit(column.AutoSizeMode))
            {
                return;
            }
            float num = this.MeasureCell((GridRowElement)headerRowElement, (GridViewColumn)column, element);

            this.Detach(elementProvider, (GridCellElement)element);
            ColumnGroupsCellArrangeInfo columnData = rowLayout.GetColumnData((GridViewColumn)column);

            if ((double)columnData.Bounds.Width < (double)num)
            {
                rowLayout.StartColumnResize((GridViewColumn)column);
                rowLayout.ResizeColumn((int)((double)num - (double)columnData.Bounds.Width));
                rowLayout.InvalidateLayout();
                this.TableElement.ViewElement.InvalidateMeasure(true);
                this.TableElement.ViewElement.UpdateLayout();
                rowLayout.EndColumnResize();
            }
            if (!bestFitChildColumns)
            {
                return;
            }
            foreach (GridViewColumn dataColumn in this.GetDataColumns(column.Group))
            {
                this.BestFitColumnCore(dataColumn, mode.HasValue ? mode.Value : column.AutoSizeMode);
            }
        }
コード例 #13
0
        protected virtual void BestFitColumnsCore(BestFitColumnMode?mode)
        {
            BestFitColumnMode?nullable = mode;

            if ((nullable.GetValueOrDefault() != BestFitColumnMode.None ? 0 : (nullable.HasValue ? 1 : 0)) != 0)
            {
                return;
            }
            List <GridViewDataColumn> columns     = new List <GridViewDataColumn>((IEnumerable <GridViewDataColumn>) this.tableElement.ViewTemplate.Columns);
            ColumnGroupRowLayout      groupLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (groupLayout != null)
            {
                columns.Sort((Comparison <GridViewDataColumn>)((A, B) =>
                {
                    ColumnGroupsCellArrangeInfo columnData1 = groupLayout.GetColumnData((GridViewColumn)A);
                    ColumnGroupsCellArrangeInfo columnData2 = groupLayout.GetColumnData((GridViewColumn)B);
                    if (columnData1 == columnData2)
                    {
                        return(0);
                    }
                    if (columnData1 == null)
                    {
                        return(-1);
                    }
                    if (columnData2 == null)
                    {
                        return(1);
                    }
                    int num1 = columnData1.Group.Rows.IndexOf(columnData1.Row);
                    int num2 = columnData2.Group.Rows.IndexOf(columnData2.Row);
                    if (columnData1.Group != columnData2.Group)
                    {
                        return(columnData1.Bounds.X.CompareTo(columnData2.Bounds.X));
                    }
                    if (num1 != num2)
                    {
                        return(num1.CompareTo(num2));
                    }
                    return(columnData1.Bounds.X.CompareTo(columnData2.Bounds.X));
                }));
            }
            float[] numArray = new float[this.tableElement.ViewTemplate.ColumnCount];
            int     index1   = -1;

            if (mode.HasValue && mode.Value == BestFitColumnMode.AllCells)
            {
                numArray = this.CalculateColumnWidths(columns);
            }
            else
            {
                foreach (GridViewColumn column in columns)
                {
                    if (!(column is GridViewGroupColumn))
                    {
                        ++index1;
                        BestFitColumnMode mode1 = mode.HasValue ? mode.Value : column.AutoSizeMode;
                        if (column.IsVisible && mode1 != BestFitColumnMode.None)
                        {
                            float columnWidth = this.CalculateColumnWidth(column, mode1);
                            float val1        = numArray[index1];
                            numArray[index1] = Math.Max(val1, columnWidth);
                        }
                    }
                }
            }
            for (int index2 = 0; index2 < numArray.Length; ++index2)
            {
                GridViewColumn column = (GridViewColumn)columns[index2];
                if (column != null && column.IsVisible && column.AutoSizeMode != BestFitColumnMode.None && ((!column.IsGrouped || column.OwnerTemplate.ShowGroupedColumns) && column.CanStretch))
                {
                    this.SetColumnWidth(column, numArray[index2]);
                }
            }
            if (this.tableElement.ViewTemplate.AutoSizeColumnsMode == GridViewAutoSizeColumnsMode.Fill)
            {
                return;
            }
            this.BestFitGroupColumns(mode);
        }
コード例 #14
0
        public virtual bool EnsureCellVisible(GridViewRowInfo rowInfo, GridViewColumn column)
        {
            if (!this.TableElement.ElementTree.Control.Visible || this.TableElement.ElementTree.Control.Size == Size.Empty)
            {
                return(false);
            }
            this.EnsureRowVisible(rowInfo);
            GridRowElement rowElement = this.GetRowElement(rowInfo);

            if (rowElement == null || column == null || (!column.IsVisible || column.IsGrouped) || column.OwnerTemplate.Parent == null && column.IsPinned)
            {
                return(false);
            }
            Rectangle empty     = Rectangle.Empty;
            Rectangle rectangle = rowInfo.PinPosition != PinnedRowPosition.Top ? (rowInfo.PinPosition != PinnedRowPosition.Bottom ? this.ViewElement.ScrollableRows.ControlBoundingRectangle : this.ViewElement.BottomPinnedRows.ControlBoundingRectangle) : this.ViewElement.TopPinnedRows.ControlBoundingRectangle;
            bool      flag1     = rowElement.ElementTree.Control.RightToLeft == RightToLeft.Yes;
            GridVirtualizedRowElement virtualizedRowElement = rowElement as GridVirtualizedRowElement;

            if (virtualizedRowElement != null)
            {
                rectangle.X = virtualizedRowElement.ScrollableColumns.ControlBoundingRectangle.X;
                if (flag1)
                {
                    rectangle.X -= virtualizedRowElement.TableElement.CellSpacing;
                }
                rectangle.Width = virtualizedRowElement.ScrollableColumns.ControlBoundingRectangle.Width;
            }
            foreach (GridCellElement visualCell in rowElement.VisualCells)
            {
                if ((visualCell.ColumnInfo == null || !visualCell.ColumnInfo.IsPinned) && visualCell.ColumnInfo == column)
                {
                    if (visualCell.ControlBoundingRectangle.Width > rectangle.Width)
                    {
                        return(false);
                    }
                    if (visualCell.ControlBoundingRectangle.Right > rectangle.Right + 1)
                    {
                        if (this.TableElement.ColumnScroller.ScrollMode == ItemScrollerScrollModes.Discrete)
                        {
                            int num1 = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1;
                            int num2 = column.Index;
                            if (num2 > num1)
                            {
                                num2 = num1;
                            }
                            this.ColumnScroller.Scrollbar.Value = num2;
                        }
                        else
                        {
                            int num = visualCell.ControlBoundingRectangle.Right - rectangle.Right;
                            if (flag1)
                            {
                                num *= -1;
                            }
                            this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, this.ColumnScroller.Scrollbar.Value + num);
                        }
                    }
                    if (visualCell.ControlBoundingRectangle.X < rectangle.X - 1)
                    {
                        if (this.TableElement.ColumnScroller.ScrollMode == ItemScrollerScrollModes.Discrete)
                        {
                            int num1 = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1;
                            int num2 = column.Index;
                            if (num2 > num1)
                            {
                                num2 = num1;
                            }
                            this.ColumnScroller.Scrollbar.Value = num2;
                        }
                        else
                        {
                            int num = visualCell.ControlBoundingRectangle.X - rectangle.X;
                            if (flag1)
                            {
                                num *= -1;
                            }
                            this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, this.ColumnScroller.Scrollbar.Value + num);
                        }
                    }
                    return(true);
                }
            }
            if (rowInfo is GridViewGroupRowInfo)
            {
                return(false);
            }
            ColumnGroupRowLayout rowLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;

            if (rowLayout != null)
            {
                this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, rowLayout.GetColumnOffset(column));
                return(true);
            }
            int  num3 = this.ColumnScroller.Scrollbar.Value;
            bool flag2;

            if (this.TableElement.ColumnScroller.ScrollMode == ItemScrollerScrollModes.Discrete)
            {
                int num1 = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1;
                int num2 = column.Index;
                if (num2 > num1)
                {
                    num2 = num1;
                }
                this.ColumnScroller.Scrollbar.Value = num2;
                this.TableElement.Invalidate();
                flag2 = true;
            }
            else
            {
                flag2 = this.ColumnScroller.ScrollToItem(column, false);
            }
            if (num3 < this.ColumnScroller.Scrollbar.Value)
            {
                this.UpdateLayout();
                foreach (GridCellElement visualCell in rowElement.VisualCells)
                {
                    if ((visualCell.ColumnInfo == null || !visualCell.ColumnInfo.IsPinned) && visualCell.ColumnInfo == column)
                    {
                        this.ChangeScrollbarValue(this.ColumnScroller.Scrollbar, this.ColumnScroller.Scrollbar.Value + (flag1 ? rectangle.Left - visualCell.ControlBoundingRectangle.Left : visualCell.ControlBoundingRectangle.Right - rectangle.Right));
                    }
                }
            }
            return(flag2);
        }
コード例 #15
0
        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;
                    }
                }
            }
        }
コード例 #16
0
 public ColumnGroupLayoutTree(ColumnGroupRowLayout owner, GridViewTemplate template)
 {
     this.template = template;
     this.owner    = owner;
 }
コード例 #17
0
        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));
                    }
                }
            }
        }