c# - Capture desktop exclude (under) my active window -
there many questions capture active window or desktop include active window question different:
i want capture desktop under wpf window. created sample project base on following code:
using (var screenbmp = new bitmap((int)elementsize.width,(int)elementsize.height, system.drawing.imaging.pixelformat.format32bppargb)) { using (var bmpgraphics = graphics.fromimage(screenbmp)) { bmpgraphics.copyfromscreen((int) topleftpoint.x, (int)topleftpoint.y, 0, 0, screenbmp.size); return imaging.createbitmapsourcefromhbitmap( screenbmp.gethbitmap(), intptr.zero, int32rect.empty, bitmapsizeoptions.fromemptyoptions()); } }
it can capture desktop element copyfromscreen
result picture of element but want capture desktop under element, not include element in window.
note: element (for example rectangle) background semi-transparent or none-transparent (has image or solid color).
the above code result below picture (the part inside red border).
note: tree desktop background picture & part of application visible in image. window on them.
you can see include rectangle (element) , other controls on but want capture desktop under element, exclude , visual of other elements on it.
now question how can capture desktop under element in wpf window, in 2 mode such result below pictures? :
- a) include things (windows &...) under window, this:
- b) exclude other things (exclude open windows &...) under window. desktop background , icons (if window on icons). this:
do know special library or api capture desktop in above levels?
note: working platform wpf + .net 4.5
Comments
Post a Comment