c# - Take screenshot of a program with visual style -


i'm using code

public static bitmap printwindow(intptr hwnd) {       rect rc;       getwindowrect(hwnd, out rc);        bitmap bmp = new bitmap(rc.width, rc.height, pixelformat.format24bpprgb);       graphics gfxbmp = graphics.fromimage(bmp);       intptr hdcbitmap = gfxbmp.gethdc();        printwindow(hwnd, hdcbitmap, 0);        gfxbmp.releasehdc(hdcbitmap);       gfxbmp.dispose();        return bmp;  } 

in order capture screenshot of program, works takes basic visual style (please check image below, left 1 captured code above, right 1 captured alt+prntscr)

lrr1l.png

so.. there anyway capture screenshot of program visual style?

here links can try: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.drawtobitmap.aspx http://www.pinvoke.net/default.aspx/user32.printwindow

what use is:

[system.runtime.interopservices.dllimport("gdi32.dll")] public static extern long bitblt(intptr hdcdest, int nxdest, int nydest, int nwidth, int nheight, intptr hdcsrc, int nxsrc, int nysrc, int dwrop); private bitmap memoryimage; 

...

private void capturewindow() {     graphics mygraphics = this.creategraphics();     size s = this.size;     memoryimage = new bitmap(s.width, s.height, mygraphics);     graphics memorygraphics = graphics.fromimage(memoryimage);     intptr dc1 = mygraphics.gethdc();     intptr dc2 = memorygraphics.gethdc();     //bitblt(dc2, 0, 0, this.clientrectangle.width, this.clientrectangle.height, dc1, 0, 0, 13369376);     bitblt(dc2, 0, 0, this.clientrectangle.width, this.clientrectangle.height, dc1, 0, 0, 0x00cc0020);     mygraphics.releasehdc(dc1);     memorygraphics.releasehdc(dc2); } 

where memoryimage bitmap print.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -