Back to Devexpress

Lesson 1 - Show the Print Preview for a Link

windowsforms-90-controls-and-libraries-printing-exporting-getting-started-lesson-1-show-the-print-preview-for-a-link.md

latest2.1 KB
Original Source

Lesson 1 - Show the Print Preview for a Link

  • Aug 15, 2025
  • 2 minutes to read

This lesson illustrates how to create a basic printing link that creates an empty document, and how to create a Print Preview in a Windows Forms Application to show this document.

View Example: Get Started with Printing Library

To create a Print Preview and show a document in it, do the following.

  1. Create a new Windows Forms Application in Visual Studio.

  2. To add a print preview to your application, switch to the application’s main form in Visual Studio, and press CTRL+ALT+X to run the Toolbox. Expand the DX.25.2: Reporting category and drop the DocumentViewer control onto the form.

  3. Click the smart tag of the control, and in the invoked actions list, select a toolbar that matches the user interface style of the rest of your application. In this tutorial, the ribbon toolbar is preferred over the minimal bar interface.

  4. To assign a document source to the control, click its smart tag again. In the drop-down menu of the DocumentViewer.DocumentSource property, expand the Standard Sources category and select PrintingSystem.

  5. Press F7 to switch to the code view, and declare a new public class (called Lesson1 ), inherited from the Link class.

  6. Handle the main form’s Load event and add the following code to the event handler.

Launch the application and view the result.

See Also

Lesson 2 - Draw Simple Text