在运行时在printdocument控件中绘制 [英] drawing in runtime in printdocument control

查看:111
本文介绍了在运行时在printdocument控件中绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们.

推荐答案

在PrintDocument PrintPage事件处理程序中,使用PrintPageEventArgs.Graphics对象:
In the PrintDocument PrintPage event handler, use the PrintPageEventArgs.Graphics object:
private void pd_PrintPage(object sender, PrintPageEventArgs e) 
   {      
   // Draw a picture.
   e.Graphics.DrawImage(Image.FromFile(@"F:\Temp\MyPicture.bmp"), e.Graphics.VisibleClipBounds);
   e.Graphics.DrawRectangle(myPen, myRectangle);
   e.Graphics.DrawString("Hello!", myFont, myBrush, myPoint);
   e.HasMorePages = false;  //Last page
   }



[edit]奇怪-右括号不会停留在我所说的位置...-OriginalGriff [/edit]



[edit]Strange - the close bracket would not stay where I put it... - OriginalGriff[/edit]


^ ]应该可以帮助您入门.您只需要在PrintDocument.PrintPage()事件中添加使这些方法生效,就可以立即进行打印.

快乐编码
This Drawing Lines and Shapes with GDI+[^] should get you started. You just need to add put these methods into effect in the PrintDocument.PrintPage() event, and you should be printing in no time.

Happy Coding


这篇关于在运行时在printdocument控件中绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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