Example E6
Visible to All Users

XtraPrinting Library - How to Create a non-printable Brick

This example illustrates how to create a brick that is visible on the screen, but is not printed.

All bricks created by the XtraPrinting Library can be printed. Occasionally you have to create bricks used for navigation purposes only. Although these bricks are displayed on screen, they should be excluded from the printout. Use the Brick.Printed property to disable printing.

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

Form1.cs(vb)
C#
using System; using System.Windows.Forms; using System.Drawing; using DevExpress.XtraPrinting; // ... namespace NonPrintBrick { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btn_NonPrintableBrick_Click(object sender, EventArgs e) { BrickGraphics graph = printingSystem1.Graph; // Start the report generation. printingSystem1.Begin(); // Set the modifier - specify the page area. graph.Modifier = BrickModifier.MarginalHeader; string format = "Page {0} of {1}"; graph.Font = graph.DefaultFont; graph.BackColor = Color.Transparent; RectangleF r = new RectangleF(0, 0, 0, ((Font)graph.Font).Height); // Create a brick. PageInfoBrick brick = graph.DrawPageInfo(PageInfo.NumberOfTotal, format, Color.Black, r, BorderSide.None); brick.Alignment = BrickAlignment.Far; brick.AutoWidth = true; // Create another brick with different alignment. brick = graph.DrawPageInfo(PageInfo.DateTime, "{0:MMMM dd}", Color.Black, r, BorderSide.None); // Change the page area - set the modifier. printingSystem1.Graph.Modifier = BrickModifier.DetailHeader; graph.BackColor = Color.Silver; // Create a brick, which will be hidden in the printout. TextBrick tBrick = new TextBrick(BorderSide.None, 1, Color.Black, Color.Khaki, Color.Blue); tBrick.Url = "http://www.devexpress.com"; tBrick.Text = "Click here to visit our web site"; tBrick.CanPublish = false; printingSystem1.Graph.DrawBrick(tBrick, new RectangleF(0, 0, 200, 20)); // Create a brick - a column header. printingSystem1.Graph.DrawString("Report Items", Color.Black, new RectangleF(0, 20, 200, 20), BorderSide.All); // Change the page area - set the modifier. printingSystem1.Graph.Modifier = BrickModifier.Detail; graph.BackColor = Color.White; // Create bricks. for(int i = 0; i < 100; i++) printingSystem1.Graph.DrawString("Item N" + Convert.ToString(i + 1), Color.Black, new RectangleF(0, 20 * i, 200, 20), BorderSide.All); // Finish the report generation. printingSystem1.End(); // Preview the report. printingSystem1.PreviewFormEx.Show(); } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.