开发者

C# Print Preview

I am attempti开发者_运维技巧ng to create a preview of a letter my program automatically prints nightly. I have read a few articles, but still am having trouble understanding.

I understand I need to create a PrintPreviewDialog object, which I can call ShowDialog() on, once I've supplied it with a PrintDocument. My main question is, how do I create a PrintDocument?

I have all the information for the letter saved in separate variables, so I'll have to combine all of them, which is easy enough, but how do I change that object (StringBuilder) into a PrintDocument I can provide to the PrintPreviewDialog object?

As always, thanks for any help!


The print logic you have to put it inside a PrintPage event handler of the PrintDocument.

You can read http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx . It contains a complete example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜