Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Collapse]Printing-Exporting
   [Expand]Product Information
   [Collapse]Getting Started
     Lesson 1 - Show the Print Preview for a Link
     Lesson 2 - Draw Simple Text
     Lesson 3 - Draw Formatted Text
     Lesson 4 - Draw Formatted/Colored Text
     Lesson 5 - Insert Two Bricks
     Lesson 6 - Insert Two Rows
     Lesson 7 - Insert Two Rows and Three Columns
     Lesson 8 - Insert Three Rows and Three Columns
     Lesson 9 - Create a Multi-Page Document
   [Expand]Fundamental Concepts
   [Expand]Concepts
   [Expand]Examples
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 2 - Draw Simple Text

This lesson shows you how to create a link that generates a document displaying the "Hello World!" text.

Show Me

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

To add text to a document via a printing link, do the following.

  1. To create a new printing link, declare a new class (called Lesson2) derived from the Lesson1 class defined in the previous lesson. The new class will have three constants: top (determines the top position), r (specifies the rectangle) and caption (contains the "Hello World!" text string).

    This link overrides the Link.BeforeCreate protected method, to set the background color, border color, font, and line alignment for the BrickGraphics class. The overridden Link.CreateDetail method is used to draw a string whose text is predefined in the caption constant.

  2. Next, modify the main form's Load event handler to pass the Printing System of the Document Viewer to the new link.

Launch the application and view the result.

Expanded See Also

How would you rate this topic?​​​​​​​