问题
Is there a way to record the screen, either desktop or window, using .NET technologies.
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.
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!
回答1:
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 :-).
回答2:
You can use Windows media Encoder SDK to build a c# application to record the screen. There are in-built options to record the entire desktop, a particular window or a portion of the screen.
回答3:
There is a dll out there that can do it. Don't remember the name of it but it's used by Jing. A friend of mine implemented a screen recorder in just a few minutes by using that dll, just for testing. Check out Jing and you'll probably find the dll they use.
回答4:
You can use Media Encoder SDK but it is not supported on Windows 7.
回答5:
You may try this opensource utility: ScreenRecord (http://screenrecord.codeplex.com/) it's based on AForge.NET
来源:https://stackoverflow.com/questions/397754/record-video-of-screen-using-net-technologies