c# - Capturing windows form into image -



c# - Capturing windows form into image -

i know question has been answered before. none of answers correct. how can capture image of windows form , save it. utilize this:

bitmap bmp = new bitmap(this.width, this.height); this.drawtobitmap(bmp, new rectangle(point.empty, bmp.size)); bmp.save(@"c://desktop//sample.png",imageformat.png);

but error:

a generic error occurred in gdi+

i have read error none of suggestions work me! please help

the problem in bmp.save(@"c://desktop//sample.png",imageformat.png);.

first must @"c:\desktop\sample.png", don't need escape nil verbatim string.

second create sure path corect , have permision write to.

third sayse point out dispose bitmap.

using(bitmap bmp = new bitmap(this.width, this.height)) { this.drawtobitmap(bmp, new rectangle(point.empty, bmp.size)); bmp.save(@"c:\desktop\sample.png",imageformat.png); // create sure path exists! }

c# capture

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -