I want to take the screenshot of the Scala Player window.I tried to capture the Scala player using the ‘Bitmap’ class and the ‘CopyFromScreen’ method in my program. However, each time I run the program, it generates a white blank image. It would be a huge help if someone can give me an alternative approach to my problem.

//Creating a new Bitmap object
Bitmap captureBitmap = new Bitmap(1920, 1080, PixelFormat.Format32bppArgb);

//Creating a Rectangle object which will capture our Current Screen
Rectangle captureRectangle = Screen.AllScreens[0].Bounds;

//Creating a New Graphics Object
Graphics captureGraphics = Graphics.FromImage(captureBitmap);

//Copying Image from The Screen
captureGraphics.CopyFromScreen(captureRectangle.Left, captureRectangle.Top, 0, 0, captureRectangle.Size);

New contributor

Rohz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.