Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
« »

Printing into a PrintPreview control II

Blogged by Björn Meyer on November 19, 2007 and tagged with Printing, Samples.

In this sample, I explained how to print into a .NET Framework PrintPreviewDialog control.

http://www.textcontrol.com/downloads/library/printing/preview2/

A customized PrintController has been derived from the PrintController class. But I forgot to tell you to reset the PrintController after initializing the dialog. This is important, because the dialog provides a button to print the content to the specified printer directly. If the PrintController is the inherited one, its content will not be printed.

Therefore, we have to pass a new PrintController, after the dialog has been initialized. We can attach an Actived event where the dialog will be opened:

pp.Activated += new EventHandler(pp_Activated);

In the event, we will create a new PrintController:

void pp_Activated(object sender, EventArgs e)
{
pp.Document.PrintController = new StandardPrintController();
}

The PrintPreviewDialog must be accessible in this sample:

private PrintPreviewDialog pp = new PrintPreviewDialog();
« Prev:Drag And Drop Text inside TX Text Control .NET
» Next:Version 14.0 Release and Happy Holidays

top

Top 10 Bestselling Product Award 2007Top 25 Publisher Product Award 2007Top 10 Bestselling Product Award 2007 in JapanTop 25 Bestselling Product Award 2006Top 25 Bestselling Publisher Award 2006Reader's Choice Award, dot.net magazin, 3rd place