protected override void CreateBricksForRecord(XRDataRecord record, PanelBrick parentBrick, bool isHeader, ref float actualHeight)
        {
            XRTreeListNode     node = record as XRTreeListNode;
            PrintNodeEventArgs args = new PrintNodeEventArgs(node);

            if (!isHeader)
            {
                TreeList.OnPrintNode(args);
            }

            if (args.SuppressType == NodeSuppressType.Leave)
            {
                int nodeLevel = node.Level;

                TreeListNodeBrick nodeBrick = new TreeListNodeBrick(TreeList, (DataContainerBrick)parentBrick, isHeader);
                nodeBrick.Style     = XRControlStyle.Default.Clone() as XRControlStyle;
                nodeBrick.Separable = false;

                RecordPrintCache cache = new TreeListNodePrintCache(nodeBrick, node.Level);

                List <VisualBrick>   childBricks    = new List <VisualBrick>();
                List <XRFieldHeader> visibleHeaders = TreeList.VisibleHeaders;

                for (int i = 0; i < visibleHeaders.Count; i++)
                {
                    VisualBrick valueBrick = CreateCellBrick(TreeList, parentBrick, node, i, isHeader);
                    childBricks.Add(valueBrick);
                }

                CorrectBrickBounds(nodeBrick, childBricks, nodeLevel * TreeList.NodeIndent, actualHeight);
                float nodeHeight = nodeBrick.Rect.Height;

                VisualBrickHelper.SetBrickBounds(nodeBrick, nodeBrick.Rect, TreeList.Dpi);

                parentBrick.Bricks.Add(nodeBrick);

                actualHeight += nodeHeight;

                if (!IsDesignMode)
                {
                    if (isHeader)
                    {
                        ((DataContainerBrick)parentBrick).PrintCache.HeaderCache = cache;
                    }
                    else
                    {
                        ((DataContainerBrick)parentBrick).PrintCache.RecordsCache.Add(cache);
                    }
                }
            }

            if (args.SuppressType != NodeSuppressType.SuppressWithChildren)
            {
                foreach (XRTreeListNode childNode in node.Nodes)
                {
                    CreateBricksForRecord(childNode, parentBrick, isHeader, ref actualHeight);
                }
            }
        }
        internal void InitializeControlArea(DocumentBandKind bandKind, DocumentBand parentBand, XRWriteInfo writeInfo, XRDataContainerPrintCache cache)
        {
            DocumentBand band = new DocumentBand(bandKind, 0);

            parentBand.Bands.Add(band);
            DataContainerBrick brick = CreateContainerBrick(this, bandKind.Equals(DocumentBandKind.PageHeader)); // 'Equals()' instead of '==' is for VB Converter

            brick.PrintCache = cache;
            this.PutStateToBrick(brick, writeInfo.PrintingSystem);
            VisualBrickHelper.InitializeBrick(brick, writeInfo.PrintingSystem, brick.Rect);
            band.Bricks.Add(brick);
        }
예제 #3
0
        protected virtual void CorrectBrickBounds(VisualBrick brick, float actualHeight)
        {
            RectangleF actualBounds;

            if (IsDesignMode)
            {
                actualBounds = ContainerControl.BoundsF;
            }
            else
            {
                actualBounds = new RectangleF(0, 0, ContainerControl.BoundsF.Width, actualHeight);
            }

            VisualBrickHelper.SetBrickBounds(brick, actualBounds, ContainerControl.Dpi);
        }
        protected override void CreateBricksForRecord(XRDataRecord record, PanelBrick parentBrick, bool isHeader, ref float actualHeight)
        {
            PrintRecordEventArgs args = new PrintRecordEventArgs(record);

            if (!isHeader)
            {
                Grid.OnPrintRecord(args);
            }

            if (!args.Cancel)
            {
                GridRecordBrick recordBrick = new GridRecordBrick(Grid, (DataContainerBrick)parentBrick, isHeader);
                recordBrick.Style     = XRControlStyle.Default.Clone() as XRControlStyle;
                recordBrick.Separable = false;

                RecordPrintCache cache = new RecordPrintCache(recordBrick);

                List <VisualBrick>   childBricks    = new List <VisualBrick>();
                List <XRFieldHeader> visibleHeaders = Grid.VisibleHeaders;

                for (int i = 0; i < visibleHeaders.Count; i++)
                {
                    VisualBrick valueBrick = CreateCellBrick(Grid, parentBrick, record, i, isHeader);
                    childBricks.Add(valueBrick);
                }

                CorrectBrickBounds(recordBrick, childBricks, 0, actualHeight);
                float recordHeight = recordBrick.Rect.Height;

                VisualBrickHelper.SetBrickBounds(recordBrick, recordBrick.Rect, Grid.Dpi);

                parentBrick.Bricks.Add(recordBrick);

                actualHeight += recordHeight;

                if (!IsDesignMode)
                {
                    if (isHeader)
                    {
                        ((DataContainerBrick)parentBrick).PrintCache.HeaderCache = cache;
                    }
                    else
                    {
                        ((DataContainerBrick)parentBrick).PrintCache.RecordsCache.Add(cache);
                    }
                }
            }
        }
        protected void CorrectBrickBounds(DataRecordBrick recordBrick, List <VisualBrick> childBricks, float indent, float actualHeight)
        {
            float recordHeight = GraphicsUnitConverter.Convert(2f, GraphicsDpi.HundredthsOfAnInch, TableControl.Dpi);

            for (int i = 0; i < childBricks.Count; i++)
            {
                if (recordHeight < childBricks[i].Rect.Height)
                {
                    recordHeight = childBricks[i].Rect.Height;
                }
            }

            for (int i = 0; i < childBricks.Count; i++)
            {
                childBricks[i].Rect = new RectangleF(childBricks[i].Rect.X, childBricks[i].Rect.Y, childBricks[i].Rect.Width, recordHeight);
                VisualBrickHelper.SetBrickBounds((VisualBrick)childBricks[i], ((VisualBrick)childBricks[i]).Rect, TableControl.Dpi);
                recordBrick.Bricks.Add(childBricks[i]);
            }

            recordBrick.Rect = new RectangleF(indent, actualHeight, TableControl.WidthF, recordHeight);
        }