打印功能在c#中不起作用 [英] print functon is not working in c#

查看:117
本文介绍了打印功能在c#中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



在这里,我想打印一个winform,因为我添加了以下编码行,但它无法正常工作。我期待着您的宝贵建议



Hi All,

Here I want to print a winform for that I have addded the following line of coding but it''s not working properly. I am looking forward to your valuable suggestions

void PrintImage(object o, PrintPageEventArgs e)
{
   int x = SystemInformation.WorkingArea.X;
   int y = SystemInformation.WorkingArea.Y;
   int width = this.Width;
   int height = this.Height;

   Rectangle bounds = new Rectangle(x, y, width, height);

   Bitmap img = new Bitmap(width, height);

   this.DrawToBitmap(img, bounds);
   Point p = new Point(100, 100);
   e.Graphics.DrawImage(img, p);
}

private void button2_Click(object sender, EventArgs e)
{
   pd.PrintPage += new PrintPageEventHandler(PrintImage);
   pd.Print();
}



谢谢&此致,

Soumya



代码块固定[/ edit]

推荐答案

http:// msdn。 microsoft.com/en-us/library/aa287529(v=vs.71).aspx [ ^ ]


这篇关于打印功能在c#中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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