询问者
C#如何调用电脑自带的截图工具实现截图

问题
全部回复
-
Hi ZhouJun Cai,
你可以使用以下代码来调用电脑自带的截图工具。
Process snippingToolProcess = new Process(); snippingToolProcess.EnableRaisingEvents = true; if (!Environment.Is64BitProcess) { snippingToolProcess.StartInfo.FileName = "C:\\Windows\\sysnative\\SnippingTool.exe"; snippingToolProcess.Start(); } else { snippingToolProcess.StartInfo.FileName = "C:\\Windows\\system32\\SnippingTool.exe"; snippingToolProcess.Start(); }
希望这个会对你有所帮助。
Best Regards,
Jack
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com. -
-
Hi
感谢您的反馈。
通常而言,截图是需要我们手动进行的。或者说你想截当前屏幕整个屏幕?那你可以点击全屏截图去实现。
关键在于你想截图截多大,这个我们没有办法用代码进行控制。
所以,我的建议是把根据调用出来后再选取你想要截图的区域。
Best Regards,
Jack
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com. -
Hi
如果你想截取整个屏幕的话,我建议你可以使用以下代码来截屏。
using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; using Rectangle = System.Drawing.Rectangle; Rectangle bounds = Screen.PrimaryScreen.Bounds; using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size); bitmap.Save("D://test.jpg", ImageFormat.Jpeg); }
这样就可以获取全屏的截图了。
Best Regards,
Jack
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.