[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
    [Expand]Print Preview
    [Collapse]Using Bricks
      How to: Use Bricks of Different Types
      How to: Use Modifiers of BrickGraphics
      How to: Draw a Line Brick
      How to: Modify Brick Appearance using Styles
      How to: Unite Bricks into a Non-Separable Group
      How to: Insert a Page Break between Two Bricks
      How to: Create a Non-Printable Brick
      How to: Create a Custom Brick Inherited from a Standard Brick
      How to: Create a Custom Brick Implementing the IBrick Interface
    [Expand]Using Printing Links
    [Expand]Page Header and Footer
    [Expand]Printing DevExpress Controls
  [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)

How to: Create a Custom Brick Inherited from a Standard Brick

The XtraPrinting Library enables you to create your own custom Bricks, and use them in your document. In this topic we introduce one of the approaches to accomplishing this task, which requires deriving a custom brick class from one of the existing brick classes (either the BrickBase class, or its descendants). For information on creating custom bricks by implementing the IBrick interface, refer to the How to: Create a Custom Brick Implementing the IBrick Interface tutorial.

Expanded Inheriting a Custom HyperLinkBrick from the TextBrick

Deriving from an existing brick classes allows you quickly create a custom brick and add extra functionality. This example demonstrates how you can create a custom HyperLinkBrick brick. This brick inherits from the TextBrick class, since a TextBrick provides most of the functionality needed for the new brick type.

The purpose of a new brick is to represent hyperlink addresses in a report. This hyperlink is enabled in the report's preview, and the end-user can click it and open a link in the default browser.

The new brick class implements two constructors, used to initialize a HyperLinkBrick class instance. The first constructor has one parameter specifying the url; in this case the displayed hint contains this link. The second one includes two parameters: the url string and the hint text.

The TextBrickBase.ForeColor and TextBrick.Font properties of the base class are hidden and new methods are implemented instead. By default, the Font property sets the text font to be underlined. The ForeColor property sets the text color to blue.

Expanded Using the HyperLinkBrick

Now you can create and add the HyperLinkBrick to your report as demonstrated below.

Note: you can certainly create this brick using the standard brick type, but the HyperLinkBrick class makes this task easier.


A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E91.

Expanded See Also

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