Current filter:
                                You should refresh the page.
                                Support Center

                                How to insert a page break between two bricks

                                0

                                This example demonstrates how to insert a page break between two bricks in a document. To accomplish this task, the PrintingSystem.InsertPageBreak method should be used, as demonstrated in the code snippet below.

                                You must  log in  or  register  to leave comments
                                Select file
                                • Form1.cs
                                • Program.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2013 vol 1.4 - v2013 vol 2.9
                                • v2008 vol 2.2 - v2012 vol 2.16
                                using System;
                                using System.Windows.Forms;
                                
                                using System.Drawing;
                                using DevExpress.XtraPrinting;
                                // ...
                                
                                namespace docPrintingSystemInsertPageBreak {
                                    public partial class Form1 : Form {
                                        public Form1() {
                                            InitializeComponent();
                                        }
                                
                                        private void button1_Click(object sender, EventArgs e) {
                                            // Start report generation.
                                            printingSystem1.Begin();
                                
                                            // Obtain the Printing System's graphics.
                                            BrickGraphics gr = printingSystem1.Graph;
                                
                                            // Specify graphics settings.
                                            gr.Modifier = BrickModifier.Detail;
                                            gr.BackColor = Color.FromArgb(26, 26, 154);
                                            gr.BorderColor = Color.FromArgb(254, 202, 2);
                                
                                            // Insert a text brick.
                                            string s = "XtraPrinting Library";
                                            TextBrick textBrick = new TextBrick();
                                            textBrick = gr.DrawString(s, Color.FromArgb(67, 145, 252),
                                                new RectangleF(0, 0, 286, 80), BorderSide.All);
                                            textBrick.Font = new Font("Arial", 20, FontStyle.Bold | FontStyle.Italic);
                                            BrickStringFormat bsf = new BrickStringFormat(StringAlignment.Center,
                                                StringAlignment.Center);
                                            textBrick.StringFormat = bsf;
                                
                                            // Insert a page break.
                                            printingSystem1.InsertPageBreak(81);
                                
                                            // Insert an image brick.
                                            Image img = Image.FromFile(@"..\..\logo.png");
                                            ImageBrick imageBrick = new ImageBrick();
                                            imageBrick = gr.DrawImage(img, new RectangleF(0, 81, 286, 81));
                                
                                            // Finish report generation.
                                            printingSystem1.End();
                                
                                            // Display the Print Preview form.
                                            printingSystem1.PreviewFormEx.Show();
                                        }
                                    }
                                }

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners