日期:2014-05-18  浏览次数:21329 次

wpf如何实现类似QQ截图功能
我现在已经做了一部分了,就是不知道像QQ的调整截图矩形框大小的这一个怎么做,我截图矩形框是继承canvas画的,希望给相关代码学习

------解决方案--------------------
请问你知道怎么在wpf里 通过一个网络连接(一个视频的连接)得到这个视频的某一帧的截图吗?
------解决方案--------------------
不懂·帮你顶
------解决方案--------------------
每天评论一条,你好我好大家好
------解决方案--------------------
一起期待问题的解决
------解决方案--------------------
Size sz = Screen.PrimaryScreen.Bounds.Size;
IntPtr hDesk = GetDesktopWindow();
IntPtr hSrce = GetWindowDC(hDesk);//获取窗口的设备环境
IntPtr hDest = CreateCompatibleDC(hSrce);//创建设备环境的兼容性到类存
IntPtr hBmp = CreateCompatibleBitmap(hSrce, sz.Width, sz.Height);//创建图为
IntPtr hOldBmp = SelectObject(hDest, hBmp);
bool b = BitBlt(hDest, 0, 0, sz.Width, sz.Height, hSrce, 0, 0, CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt);
Bitmap bmp = Bitmap.FromHbitmap(hBmp);
SelectObject(hDest, hOldBmp);
DeleteObject(hBmp);
DeleteDC(hDest);
ReleaseDC(hDesk, hSrce);
bmp.Save(@"c\\test.png");

------解决方案--------------------
public static extern UInt32 RegisterHotKey(IntPtr hWnd, UInt32 id, UInt32 fsModifiers, UInt32 vk); //API 
[DllImport("gdi32.dll")]
static extern bool BitBlt(IntPtr hdcDest, int xDest, int yDest, int
wDest, int hDest, IntPtr hdcSource, int xSrc, int ySrc, CopyPixelOperation rop);
[DllImport("user32.dll")]
static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDc);
[DllImport("gdi32.dll")]
static extern IntPtr DeleteDC(IntPtr hDc);
[DllImport("gdi32.dll")]
static extern IntPtr DeleteObject(IntPtr hDc);
[DllImport("gdi32.dll")]
static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);
[DllImport("gdi32.dll")]
static extern IntPtr CreateCompatibleDC(IntPtr hdc);
[DllImport("gdi32.dll")]
static extern IntPtr SelectObject(IntPtr hdc, IntPtr bmp);
[DllImport("user32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
public static extern IntPtr GetWindowDC(IntPtr ptr);
------解决方案--------------------

------解决方案--------------------
周银辉MVP的WPF截图程序,非常不错.

屏幕截图程序