使用 .NET 技术录制屏幕视频 [英] Record Video of Screen using .NET technologies

查看:89
本文介绍了使用 .NET 技术录制屏幕视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 .NET 技术记录屏幕(桌面或窗口).

Is there a way to record the screen, either desktop or window, using .NET technologies.

我的目标是免费的东西.我喜欢小巧、低 CPU 使用率和简单的想法,但如果他们创造出更好的最终产品,我会考虑其他选择.

My goal is something free. I like the idea of small, low cpu usage, and simple, but would consider other options if they created a better final product.

简而言之,我知道如何在 C# 中截取屏幕截图,但如何将屏幕或屏幕区域记录为视频?

In a nutshell, I know how to take a screenshot in C#, but how would I record the screen, or area of the screen, as a video?

非常感谢您的想法和时间!

Thanks a lot for your ideas and time!

推荐答案

不需要第三方 DLL.这个简单的方法将当前屏幕图像捕获到 .NET Bitmap 对象中.

There is no need for a third party DLL. This simple method captures the current screen image into a .NET Bitmap object.

    private Image CaptureScreen()
    {
        Rectangle screenSize = Screen.PrimaryScreen.Bounds;
        Bitmap target = new Bitmap(screenSize.Width,screenSize.Height);
        using(Graphics g = Graphics.FromImage(target))
        {
            g.CopyFromScreen(0,0,0,0,new Size(screenSize.Width,screenSize.Height));
        }
        return target;
    }

如果需要,我相信您可以弄清楚如何捕获屏幕的一小部分:-).

I am sure you can figure out how to capture a smaller portion of the screen, if that is needed :-).

这篇关于使用 .NET 技术录制屏幕视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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