打印屏幕编码 [英] coding for print screen
本文介绍了打印屏幕编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
单击按钮时如何打开打印屏幕.
我需要在Window应用程序(ASP.NET)和Web应用程序(C#.NET)中进行编码. Windows窗体应用程序中的屏幕截图.
int i = 0; foreach (Screen a in Screen.AllScreens) { Bitmap b = new Bitmap(a.WorkingArea.Width, a.WorkingArea.Height); Graphics g = Graphics.FromImage(b); g.CopyFromScreen(a.WorkingArea.Left, a.WorkingArea.Top, 0, 0, b.Size); g.Dispose(); string location = "C:\\Temp\\" + i.ToString() + ".bmp"; try { b.Save(location); } catch (System.Exception) { //Most probably a wrong path name or file sharing violation occured } finally { b.Dispose(); } i++; }
我认为您可能正在寻找PrintDialog类.
在此处查看MSDN [ 解决方案
Hi, I hope thos helps you for creating a screenshot in a windows forms application.
int i = 0; foreach (Screen a in Screen.AllScreens) { Bitmap b = new Bitmap(a.WorkingArea.Width, a.WorkingArea.Height); Graphics g = Graphics.FromImage(b); g.CopyFromScreen(a.WorkingArea.Left, a.WorkingArea.Top, 0, 0, b.Size); g.Dispose(); string location = "C:\\Temp\\" + i.ToString() + ".bmp"; try { b.Save(location); } catch (System.Exception) { //Most probably a wrong path name or file sharing violation occured } finally { b.Dispose(); } i++; }
Hi,
I think you might be looking for the PrintDialog class.
See MSDN here[^]
Dave
这篇关于打印屏幕编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文