WPF矩形捕获 [英] WPF Rectangle capture

查看:93
本文介绍了WPF矩形捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有WPF的Screen Capture类可以捕获整个指定的矩形?



请在VB中





我在互联网上找到:

Is there any Screen Capture class for WPF that allows you to capture Whole Specified Rectangle ?

Please in VB


I found on the internet :

private static BitmapSource CopyScreen()
    {
        using (var screenBmp = new Bitmap(
            (int)SystemParameters.PrimaryScreenWidth,
            (int)SystemParameters.PrimaryScreenHeight,
            PixelFormat.Format32bppArgb))
        {
            using (var bmpGraphics = Graphics.FromImage(screenBmp))
            {
                bmpGraphics.CopyFromScreen(0, 0, 0, 0, screenBmp.Size);
                return Imaging.CreateBitmapSourceFromHBitmap(
                    screenBmp.GetHbitmap(),
                    IntPtr.Zero,
                    Int32Rect.Empty,
                    BitmapSizeOptions.FromEmptyOptions());
            }
        }
    }



但我看不懂这个。


But I can't read this.

推荐答案

例如,请参阅: http://sourceforge.net/projects/screencapturewp/ [ ^ ]。



As这是一个开放代码,你总能看到它是如何工作的。



另请参阅此CodeProject文章: WPF中的屏幕捕获& WinForms应用程序 [ ^ ]。



问题其实非常简单。你可以找到更多: http://bit.ly/19y71d6 [ ^ ]。



-SA
See, for example: http://sourceforge.net/projects/screencapturewp/[^].

As this is an open-code code, you can always see how it works.

See also this CodeProject article: Screen Capture in WPF & WinForms Application[^].

The problem is actually pretty simple. You can find a lot more: http://bit.ly/19y71d6[^].

—SA


这篇关于WPF矩形捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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