I have a problem with code optimization. My program each tick makes a screenshot of the screen and copies from it a plot for the bitmap attribute.
Graphics bmpGraphics; Bitmap bitmap; Bitmap GetScreen() { using (bmpGraphics = Graphics.FromImage(bitmap)) { rp = Form1.regionPos;//l_pos bmpGraphics.CopyFromScreen(rp.X, rp.Y, 0, 0, new Size(390, 50)); } Thread.Sleep(1); return bitmap; } When you run the program, the performance of the computer is almost halved. Perhaps because I initially receive images of the entire screen, and then I cut out the necessary area from it.
How can I speed up the application?