开发者

How to quickly add a single printout to a simple .net winforms app?

开发者 https://www.devze.com 2023-01-22 13:20 出处:网络
I\'ve nearly completed a tiny winforms app (.net 3.5) and the last thing remaining is a pr开发者_开发百科intout. The printout is pretty simple. It is printed on an A4 landscape page and consists of th

I've nearly completed a tiny winforms app (.net 3.5) and the last thing remaining is a pr开发者_开发百科intout. The printout is pretty simple. It is printed on an A4 landscape page and consists of three identical columns (those are 3 copies of a support ticket). Each column has a bit of fixed text, a logo image, and a few fields from an object. In case a field gets lengthy, I'd like the text to wrap over to the next line. But if it gets too lengthy, it should get truncated after the first N lines (N will vary among fields, mostly 2).

What would be the quickest way of doing this?

I first thought of using HTML and a browser control, but that creates unwanted headers/footers on the page. I'm looking at .NET builtin Report-Viewer and the .rdl files, but it seems to me that it's pretty clumsy and does not support the wrap logic I mentioned above. Of course I could do it all "by hand", but that then again seems like too much work.

Since this is just a single simple printout, I'd prefer to avoid linking to a huge library (or preferably - any library).


The PrintDocument class should be a good fit for this requirement.

0

精彩评论

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