c# - Capturing screenshot of Form and elements on form -
I am trying to capture the contents of a screenshot and main window on the main window. Menwindows are sometimes behind other elements and need to get screen captures without those other overlaying elements. This code currently gives a bitmap of empty main window form without any content, as there is a bunch of different dynamic UI elements. How can I capture / capture the current screenshot / main content of the main window? Posting code for MainWindow content is a long wait, so I hope this is enough.
border of rectangle = new rectangle (); Limit. Bill = Program. Manvindo Width; Limitations. Program = Manwindo height; Screenshots = new bitmap (programmable window width, programmable.window.text, pixel format.format 32bpprgb); program. Manvindo Draftbitmap (screenshot, border);
You should be able to get it by using CopyFromScreen
Graphics
method of class
rectangle border = program. main window. Bound; Bitmap b = new bitmap (border, with, bound. Height, pixel format.format 32bparbbb); Use (graphics g = graphics. Framesize (b)) {g.CopyFromScreen (bounds.X, bounds.Y, 0, 0, limit. Size, copypixel operation, sourcecopy); } B.Save ("Your file name is here");
Comments
Post a Comment