Exemple #1
0
        public static void PrintControl(IWin32Window owner, PictureEdit control)
        {
            using PrintingSystem ps = new PrintingSystem();
            Link link = new Link(ps);

            ps.Links.Add(link);

            link.CreateDetailArea += (s, e) =>
            {
                Rectangle           rect = new Rectangle(Point.Empty, control.Image.Size);
                PrintCellHelperInfo info = new PrintCellHelperInfo(
                    Color.Empty,
                    e.Graph.PrintingSystem,
                    control.EditValue,
                    control.Properties.Appearance,
                    control.Text,
                    rect,
                    e.Graph);

                e.Graph.DrawBrick((Brick)control.Properties.GetBrick(info), rect);
            };

            using (new WaitCursor())
            {
                link.CreateDocument(ps);
            }

            using var printTool = new PrintTool(ps);
            printTool.ShowRibbonPreview(owner, control.LookAndFeel);
        }
Exemple #2
0
        public override DevExpress.XtraPrinting.IVisualBrick GetBrick(PrintCellHelperInfo info)
        {
            TextBrick brick = base.GetBrick(info) as TextBrick;

            brick.XlsxFormatString = XlsxFormatString;
            return(brick);
        }
Exemple #3
0
 private void ExportPanel(PrintCellHelperInfo info, PanelBrick brick)
 {
     ExportFirstLine(info, brick);
     ExportSecondLine(info, brick);
     ExportThirdLine(info, brick);
     ExportFourthLine(info, brick);
 }
Exemple #4
0
        private void ExportFirstLine(PrintCellHelperInfo info, PanelBrick brick)
        {
            Rectangle rect = panelControl1.Bounds;

            rect.Height = dateEdit_Begin.Bounds.Height;
            ExportText(info, rect, "Begin Time", brick);
        }
Exemple #5
0
    public override IVisualBrick GetBrick(PrintCellHelperInfo info)
    {
        IProgressBarBrick brick = (IProgressBarBrick)base.GetBrick(info);

        brick.Position = ConvertValue(info.EditValue);
        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));
        }
Exemple #7
0
        private void ExportSecondLine(PrintCellHelperInfo info, PanelBrick brick)
        {
            Rectangle rect = panelControl1.Bounds;

            rect.Y     += dateEdit_Now.Bounds.Y;
            rect.Height = dateEdit_Now.Bounds.Height;
            ExportText(info, rect, "Now Time", brick);
        }
Exemple #8
0
        private void ExportFourthLine(PrintCellHelperInfo info, PanelBrick brick)
        {
            Rectangle rect = panelControl1.Bounds;

            rect.Y     += progressBarControl1.Bounds.Y;
            rect.Height = info.Rectangle.Bottom - rect.Y - info.Rectangle.Y;
            ExportText(info, rect, "Progress", brick);
        }
Exemple #9
0
        private static void ExportText(PrintCellHelperInfo info, Rectangle rect, string text, PanelBrick brick)
        {
            PrintCellHelperInfo inf = new PrintCellHelperInfo(info.LineColor, info.PS, text, info.Appearace, text, rect, info.Graph, DevExpress.Utils.HorzAlignment.Near, true, true, info.TextValueFormatString, BorderSide.All);

            using (RepositoryItemTextEdit repTE = new RepositoryItemTextEdit()) {
                TextBrick tb = (TextBrick)repTE.GetBrick(inf);
                tb.Rect = rect;
                brick.Bricks.Add(tb);
            }
        }
Exemple #10
0
        private void ExportDateEdit(PrintCellHelperInfo info, DateEdit editor, PanelBrick brick)
        {
            Rectangle rect = editor.Bounds;

            rect.Width = info.Rectangle.Right - rect.X - info.Rectangle.X;

            PrintCellHelperInfo inf = new PrintCellHelperInfo(info.LineColor, info.PS, editor.DateTime, editor.Properties.Appearance, editor.Properties.DisplayFormat.GetDisplayText(editor.EditValue), rect, info.Graph, DevExpress.Utils.HorzAlignment.Near, true, true, editor.Properties.DisplayFormat.GetFormatString(), BorderSide.All);

            TextBrick tb = (TextBrick)editor.Properties.GetBrick(inf);

            tb.Rect = rect;
            brick.Bricks.Add(tb);
        }
Exemple #11
0
        private void ExportProgressBar(PrintCellHelperInfo info, PanelBrick brick)
        {
            Rectangle rect = progressBarControl1.Bounds;

            rect.Width  = info.Rectangle.Right - rect.X - info.Rectangle.X;
            rect.Height = info.Rectangle.Bottom - rect.Y - info.Rectangle.Y;
            PrintCellHelperInfo inf = new PrintCellHelperInfo(info.LineColor, info.PS, progressBarControl1.Position, progressBarControl1.Properties.Appearance, progressBarControl1.Properties.DisplayFormat.GetDisplayText(progressBarControl1.Position), rect, info.Graph, DevExpress.Utils.HorzAlignment.Near, true, true, progressBarControl1.Properties.DisplayFormat.GetFormatString(), BorderSide.All);

            ProgressBarBrick pbb = (ProgressBarBrick)progressBarControl1.Properties.GetBrick(inf);

            pbb.Rect = rect;
            brick.Bricks.Add(pbb);
        }
Exemple #12
0
        public IVisualBrick GetBrick(PrintCellHelperInfo info)
        {
            this.EditValue = info.EditValue;
            PanelBrick brick = new PanelBrick();

            brick.BackColor = Color.White;

            ExportProgressBar(info, brick);
            ExportDateEdit(info, dateEdit_Begin, brick);
            ExportDateEdit(info, dateEdit_End, brick);
            ExportDateEdit(info, dateEdit_Now, brick);
            ExportPanel(info, brick);
            return(brick);
        }
Exemple #13
0
            public override DevExpress.XtraPrinting.IVisualBrick GetBrick(PrintCellHelperInfo info)
            {
                Bitmap   bmp = new Bitmap(info.Rectangle.Width, info.Rectangle.Height);
                Graphics gr  = Graphics.FromImage(bmp);

                gr.FillRectangle(new SolidBrush(Color.White), info.Rectangle);
                ImageBrick brick = new ImageBrick(BorderSide.None, 0, Color.Transparent, Color.Transparent);
                int        width = Convert.ToInt32(info.Rectangle.Width * Convert.ToDouble(info.EditValue) / ((double)100));

                if (width > 0)
                {
                    gr.FillRectangle(new LinearGradientBrush(new Rectangle(0, 0, width, info.Rectangle.Height), Color.LightBlue, Color.White, 90, true), new Rectangle(0, 0, width, info.Rectangle.Height));
                    brick.Image = bmp;
                }
                gr.DrawString(info.DisplayText, info.Appearace.Font, new SolidBrush(Color.Black), new PointF(0, 0));
                brick.Rect = info.Rectangle;
                return(brick);
            }
Exemple #14
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);
        }
        //Return custom brick to print image within the cells
        public override DevExpress.XtraPrinting.IVisualBrick GetBrick(PrintCellHelperInfo info)
        {
            TextBrick baseBrick = base.GetBrick(info) as TextBrick;

            if (baseBrick == null)
            {
                return(base.GetBrick(info));
            }
            IPanelBrick panelBrick = info.PS.CreatePanelBrick();
            IImageBrick imageBrick = info.PS.CreateImageBrick();

            panelBrick.Bricks.Add(baseBrick);
            panelBrick.Bricks.Add(imageBrick);
            imageBrick.Padding = new PaddingInfo(2, 2, 5, 5);
            imageBrick.Image   = this.Buttons[0].Image;
            imageBrick.Sides   = BorderSide.None;
            baseBrick.Sides    = BorderSide.None;
            baseBrick.Rect     = new System.Drawing.RectangleF(info.Rectangle.Height - 6, 0, info.Rectangle.Width - info.Rectangle.Height + 6, info.Rectangle.Height);
            imageBrick.Rect    = new System.Drawing.RectangleF(0, 0, info.Rectangle.Height - 6, info.Rectangle.Height);
            return(panelBrick);
        }
        public override IVisualBrick GetBrick(PrintCellHelperInfo info)
        {
            TextBrick  contentBrick = (TextBrick)base.GetBrick(info);
            ImageBrick imgBrick     = new ImageBrick();

            IPanelBrick panelBrick = new XETextPanelBrick(CreateBrickStyle(info, "panel"));

            SetCommonBrickProperties(panelBrick, info);
            panelBrick.Bricks.Add(imgBrick);
            panelBrick.Bricks.Add(contentBrick);

            imgBrick.Image   = GetImage();
            imgBrick.Size    = ContentImageSize;
            panelBrick.Style = contentBrick.Style;

            contentBrick.Location = new PointFloat(imgBrick.Location.X + imgBrick.Size.Width, 0);
            contentBrick.Sides    = BorderSide.None;
            contentBrick.Size     = new SizeF(info.Rectangle.Size.Width - imgBrick.Size.Width, info.Rectangle.Size.Height);
            panelBrick.Rect       = new RectangleF(0, 0, contentBrick.Rect.Width + imgBrick.Size.Width, contentBrick.Rect.Height);


            return(panelBrick);
        }