[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamental Concepts
    [Collapse]Basic Terms
      Printing System
      Printing Links
      Document Sections
      Brick Graphics
    [Expand]Print Preview
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Brick Graphics

This topic explains how you can use the BrickGraphics class to draw some content on a document page, and the IBrickGraphics interface to print DevExpress components and custom controls.

This topic consists of the following sections.

Expanded The BrickGraphics Class

The BrickGraphics class is designed to simplify the process of document creation. It provides appropriate methods for drawing various types of Bricks in a document.

The following table lists all these methods with the corresponding brick types.

Method Description Brick Type
BrickGraphics.DrawBrick Adds a custom brick to a document. Custom Brick
BrickGraphics.DrawCheckBox Adds a brick with a check box inside it. CheckBoxBrick
BrickGraphics.DrawEmptyBrick Adds a non-visual brick to combine other bricks into groups. EmptyBrick
BrickGraphics.DrawImage Adds a brick with an image inside it ImageBrick
BrickGraphics.DrawLine Adds a brick containing a line. LineBrick
BrickGraphics.DrawRect Adds a visual brick (an empty rectangle without borders). VisualBrick
BrickGraphics.DrawPageImage Adds a brick with an image inside the page header or footer. PageImageBrick
BrickGraphics.DrawPageInfo Adds a brick with page information to the page header or footer. PageInfoBrick
BrickGraphics.DrawString Adds a brick with formatted text. TextBrick

Before adding a brick, it is necessary to specify the appropriate document section via the BrickGraphics.Modifier property.

When specifying document section modifiers, you can omit any sections that are not needed but retain the following order.

For a code example, see How to: Use Modifiers of BrickGraphics.

The BrickGraphics class provides a set of options that completely define the appearance of added bricks. All these options (such as font, foreground color, background color, etc.) are in effect only for the bricks added after modifying these properties. For example, the BrickGraphics.BorderWidth property affects all bricks that are added after setting this property.

To define measurement units that are used to define the size and coordinates of a brick's rectangle, use the BrickGraphics.PageUnit property.

For a code example, see How to: Use Bricks of Different Types.

Expanded The IBrickGraphics Interface

All DevExpress components that can be printed using the XtraPrinting Library implement the IPrintable interface. Among them are the following controls.

To print these components (as well as your custom ones), you need to use the IBrickGraphics interface instead of the BrickGraphics class.

This interface provides the IBrickGraphics.DrawBrick method, which adds an object implementing the IBrick interface to a document. In fact, the BrickGraphics class also implements this interface, so all brick drawing methods of this class internally use the IBrickGraphics.DrawBrick method's implementation.

A sample application illustrating an implementation of the IPrintable interface is available online at How to implement the IPrintable interface.

Expanded See Also

Is this topic helpful?​​​​​​​