开发者

C# Print Preview

开发者 https://www.devze.com 2023-01-27 19:19 出处:网络
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 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

精彩评论

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