开发者

Printing a stackpanel

I have a WPF with content in it, and would like to pri开发者_如何转开发nt it. Using

PrintDialog pd = new PrintDialog();
if (pd.ShowDialog() == true)
   pd.PrintVisual(textStack, "Chinese Pinyin Text");

to print however, means that if I resize my window, some stuff will get cut off. How can I print it and ensure a standard 8.5x11 piece of paper with all my content, so nothing gets cut off and it correctly flows? (IE- My window is widescreen, but when it prints, it should deliver a 8.5 by 11 paper with content correctly flowing).


Can you create a FlowDocument (or other XxxxDocument) from it? FlowDocuments are relatively easy to print.


You could create a ViewBox that wraps the StackPanel and is sized to the size you want and then print the ViewBox. That might work.

Otherwise, like Patrick said, getting your visual into a FlowDocument and having that handle paging is going to be your best bet.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜