all groups > dotnet drawing api > october 2007 >
You're in the

dotnet drawing api

group:

Preview Document



Preview Document Alvaro E. Gonzalez V.
10/16/2007 11:33:13 AM
dotnet drawing api: Hi;

I'm build a wizard and it have a preview document, to this i used PrintPreviewControl, but don't
show the document, How do it?

Thanks.
Re: Preview Document Bob Powell [MVP]
10/17/2007 8:27:49 PM
Your PrintDocument has an event to which you need to add a handler.

private void button1_Click(object sender, EventArgs e)
{
PrintDocument doc = new PrintDocument();
doc.PrintPage += new PrintPageEventHandler(doc_PrintPage);
this.printPreviewDialog1.Document = doc;
this.printPreviewDialog1.ShowDialog();

}

void doc_PrintPage(object sender, PrintPageEventArgs e)
{
//Draw on the provided Graphics object here...
e.Graphics.DrawString("Hello Printer");
e.HasMorePages = false;
}

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





[quoted text, click to view]
AddThis Social Bookmark Button