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] Alvaro E. Gonzalez V. wrote:
> 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.