C#使用PrintWindow [英] C# Using PrintWindow

查看:340
本文介绍了C#使用PrintWindow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在不禁用Aero的情况下捕获win7中的窗口,并且听到 PrintWindow 有效.

I am trying to capture a window in win7 without disabling aero and I hear PrintWindow Works.

但是我不确定如何使用它,我发现了一些文章,但我看不到其中的任何图像或位图输出

But I'm not sure how to use it, I found some articles but I can't see any image or bitmap output in any of them

有没有人曾经使用过此功能并且知道如何使用它?

Has anyone ever had experience with this function and knows how to use it?

推荐答案

上一个链接此处.

来自同一链接的代码示例:

Code sample from the same link:

Graphics g = form.CreateGraphics();
Bitmap bmp = new Bitmap(form.Size.Width, form.Size.Height, g);
Graphics memoryGraphics = Graphics.FromImage(bmp);
IntPtr dc = memoryGraphics.GetHdc();
bool success = PrintWindow(form.Handle, dc, 0);
memoryGraphics.ReleaseHdc(dc);
// bmp now contains the screenshot

还可以在上面的链接中指定使用托管的

Also as specified in the above link you can use managed Control.DrawToBitamp to achieve the same thing.

这篇关于C#使用PrintWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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