示例#1
0
 public SamplePrintEventArgs(int rowHandle, GridColumn column, IVisualBrick brick, bool isPreview)
 {
     RowHandle = rowHandle;
     Column    = column;
     Brick     = brick;
     IsPreview = isPreview;
 }
示例#2
0
        protected override DevExpress.XtraPrinting.IBrick CreateCellBrick(CellInfo cell, DevExpress.XtraTreeList.Nodes.TreeListNode node)
        {
            IVisualBrick brick = base.CreateCellBrick(cell, node) as IVisualBrick;

            int lastColumnIndex = treeList.Columns.Count - 1;
            int prevIndex       = lastColumnIndex - 1;

            if (node.GetDisplayText(lastColumnIndex) == node.GetDisplayText(prevIndex))
            {
                if (cell.Column.AbsoluteIndex == lastColumnIndex)
                {
                    brick.Sides = BorderSide.Right | BorderSide.Bottom | BorderSide.Top;
                    Rectangle rect = cell.EditorViewInfo.Bounds;
                    rect.X     -= prevCell.EditorViewInfo.Bounds.Width;
                    rect.Width += prevCell.EditorViewInfo.Bounds.Width;
                    rect.Inflate(1, 1);
                    cell.SetBounds(rect, new System.Windows.Forms.Padding(0));
                }

                else if (cell.Column.AbsoluteIndex == lastColumnIndex - 1)
                {
                    brick.Sides = BorderSide.Left | BorderSide.Bottom | BorderSide.Top;
                    (brick as TextBrick).HorzAlignment = DevExpress.Utils.HorzAlignment.Far;
                    prevCell = cell;
                }
            }
            return(brick);
        }
        public override IVisualBrick GetBrick(PrintCellHelperInfo info)
        {
            IVisualBrick brick = base.GetBrick(info);

            info.Graph.DrawBrick(brick, info.Rectangle);
            return((DrawControl as IExport).GetBrick(info));
        }
        void ApplyAppearanceToBrickStyle(IVisualBrick brick, IPivotPrintAppearance appearance)
        {
            IPanelBrick panelBrick = brick as IPanelBrick;

            if (panelBrick != null)
            {
                foreach (IVisualBrick item in panelBrick.Bricks)
                {
                    ApplyAppearanceToBrickStyleCore(item, appearance);
                }
            }
            ApplyAppearanceToBrickStyleCore(brick, appearance);
        }
        protected override IVisualBrick DrawHeaderBrick(PivotFieldItemBase field, Rectangle bounds)
        {
            IPivotPrintAppearance appearance = GetFieldAppearance(field);

            SetDefaultBrickStyle(appearance, CellSizeProvider.FieldValueTextOffset, 0, 0, 0);

            string       text  = field.Caption;
            IVisualBrick brick = CreateTextBrick();

            brick.Text = text.Substring(MyPivotGridControl.ImagePlaceHolder.Length);
            if (text != null)
            {
                brick.TextValue = text;
            }
            brick.TextValueFormatString = "";
            int imageIndex = ((PivotGridField)this.Data.GetField(field)).ImageIndex;

            if (imageIndex > -1)
            {
                ImageBrick ib = new ImageBrick(BorderSide.None, 0, Color.Red, Color.Transparent);
                ib.Image = ((ImageList)this.PivotGridControl.HeaderImages).Images[imageIndex];
                int imageWidth  = ib.Image.Width;
                int imageHeight = ib.Image.Height;
                ib.BackColor   = brick.BackColor;
                ib.BorderColor = brick.BorderColor;
                brick.Sides    = BorderSide.Top | BorderSide.Right | BorderSide.Bottom;
                ib.BorderStyle = brick.BorderStyle;
                ib.BorderWidth = brick.BorderWidth;
                ib.Sides       = BorderSide.Top | BorderSide.Left | BorderSide.Bottom;
                ib.SizeMode    = ImageSizeMode.CenterImage;

                //Graph.DrawBrick(ib, new Rectangle(bounds.X, bounds.Y + (bounds.Height - imageHeight) / 2, imageWidth, imageHeight));
                Graph.DrawBrick(ib, new Rectangle(bounds.X, bounds.Y, imageWidth, bounds.Height));
                Graph.DrawBrick(brick, new Rectangle(bounds.X + imageWidth, bounds.Y, bounds.Width - imageWidth, bounds.Height));
            }
            else
            {
                Graph.DrawBrick(brick, new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height));
            }
            brick.Separable = false;
            if (Owner != null)
            {
                if (Owner.CustomExportHeader(ref brick, field, appearance, ref bounds))
                {
                    ApplyAppearanceToBrickStyle(brick, appearance);
                }
            }
            return(brick);
        }
示例#6
0
        protected override void PrintRowCell(int rowHandle, GridCellInfo cell, Rectangle r)
        {
            View.OptionsPrint.PrintPreview = true;
            string         displayText    = (View as MyGridView).GoAndGetRowCellDisplayTextCore(rowHandle, cell.Column, cell.ViewInfo, cell.CellValue, false);
            MyGridViewInfo myGridViewInfo = new MyGridViewInfo(View as MyGridView);

            myGridViewInfo.GoAndUpdateCellAppearanceCore(cell);
            if (cell.ViewInfo.AllowHtmlString)
            {
                displayText = StringPainter.Default.RemoveFormat(displayText, true);
            }
            HorzAlignment       horzAlignment = (View as MyGridView).GetHorzAlignment(rowHandle, cell.Column, cell.Appearance.HAlignment);
            PrintCellHelperInfo info          = new PrintCellHelperInfo(new Point(cell.Column == null ? -1 : cell.Column.AbsoluteIndex, rowHandle),
                                                                        LineColor,
                                                                        PS,
                                                                        cell.CellValue,
                                                                        cell.Appearance,
                                                                        displayText,
                                                                        r,
                                                                        Graph,
                                                                        horzAlignment,
                                                                        View.OptionsPrint.PrintHorzLines,
                                                                        View.OptionsPrint.PrintVertLines,
                                                                        cell.ColumnInfo.Column.DisplayFormat.FormatString,
                                                                        CalcBrickBordersEX(),
                                                                        PaddingInfo.Empty
                                                                        );

            IVisualBrick brick = cell.Editor.GetBrick(info);

            MyGridView view = this.View as MyGridView;

            view.RaiseSamplePrintEvent(this, new SamplePrintEventArgs(cell.RowHandle, cell.Column, brick, false));

            if (AllowProcessMergedInfo)
            {
                brick.Rect = r;
                UpdateMergedStatus(cell, (VisualBrick)brick);
            }
            Graph.DrawBrick(brick, r);
        }
        void ApplyAppearanceToBrickStyleCore(IVisualBrick brick, IPivotPrintAppearance appearance)
        {
            BrickStyle brickStyle = brick.Style != null ?
                                    (BrickStyle)brick.Style.Clone() :
                                    (BrickStyle)Graph.DefaultBrickStyle.Clone();

            if (appearance.Options.UseBackColor)
            {
                brickStyle.BackColor = appearance.BackColor;
            }
            if (appearance.Options.UseBorderColor)
            {
                brickStyle.BorderColor = appearance.BorderColor;
            }
            if (appearance.Options.UseBorderWidth)
            {
                brickStyle.BorderWidth = appearance.BorderWidth;
            }
            if (appearance.Options.UseBorderStyle)
            {
                brickStyle.BorderStyle = appearance.BorderStyle;
            }
            if (appearance.Options.UseFont)
            {
                brickStyle.Font = appearance.Font;
            }
            if (appearance.Options.UseForeColor)
            {
                brickStyle.ForeColor = appearance.ForeColor;
            }
            if (appearance.Options.UseTextOptions)
            {
                brickStyle.TextAlignment = TextAlignmentConverter.ToTextAlignment(appearance.TextHorizontalAlignment, appearance.TextVerticalAlignment);
                brickStyle.StringFormat  = new BrickStringFormat(appearance.StringFormat);
            }
            brickStyle.StringFormat.PrototypeKind = BrickStringFormatPrototypeKind.GenericTypographic;
            brick.Style = brickStyle;
        }