Menu Close

How can I program screen capture using C#

How Can We Help?

< Back
You are here:
Print

How can I program screen capture using C#

– add a reference to the NET DLL of the package corresponding to the .NET Framework version of the .csproj project
– start from the following sample code:

public Form1()
{
   InitializeComponent();
}

VidGrab.VideoGrabber vg;

private void Form1_Load(object sender, EventArgs e)
{
   vg = new VidGrab.VideoGrabber();
   vg.Parent = this;
   vg.Location = new Point(100, 100);
   vg.VideoSource = VidGrab.TVideoSource.vs_ScreenRecording;
   vg.StartPreview();
}

private void Button1_Click(object sender, EventArgs e)
{
   vg.CaptureFrameTo(VidGrab.TFrameCaptureDest.fc_JpegFile, “c:\\myfolder\\snapshot.jpg”);
}

Table of Contents