需要在整页上打印带有项目的groupbox .. [英] need to print groupbox with items on full page..

查看:74
本文介绍了需要在整页上打印带有项目的groupbox ..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜!!



i我的应用程序中有一个带有项目的分组框..

(基本上是一个账单)



i需要在整页打印整个组合框。(即A4尺寸页面)..



我的组合框大小是



打印预览对话框只显示半个分组框项目...



这是我的代码



hi!!

i have a groupbox with items in my application..
(its basically a bill)

i need to print the whole groupbox with its items on full page..(ie A4 size page)..

my groupbox size is

the print preview dialog shows only half groupbox items...

this is my code

void print(object sender, PrintPageEventArgs e)
 {


     int width = 1090;
     int height = 1650;


     Bitmap bmp = new Bitmap(bill_groupbox.Width,bill_groupbox.Height);

     Rectangle rec = new Rectangle(0, 0, bill_groupbox.Height, bill_groupbox.Width);

     bill_groupbox.DrawToBitmap(bmp,rec);


     e.Graphics.DrawImage(bmp, new RectangleF(0, 0, bill_groupbox.Width,bill_groupbox.Height));
     e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
     e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
     e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
    }



有人可以帮我解决这个问题..我之前没有在c#中做过任何打印......



在此先感谢:)


can someone please help me with this.. i have not done any kind of printing in c# earlier...

Thanks in Advance :)

推荐答案

为什么你要打印到位图?

使用 PrintDocument [ ^ ] - 它是什么呢专为!



然后,您可以通过循环访问GroupBox.Controls集合来打印GroupBox内容。
Why on earth are you "printing" to a bitmap?
Use a PrintDocument[^] instead - it is what it was designed for!

You can then print the GroupBox contents by looping through the GroupBox.Controls collection.


这篇关于需要在整页上打印带有项目的groupbox ..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆