C# programmatically form to image -
there 2 forms in program, form a
, form b
.
there button in form a
can take screen shot of form b
(without start form b
).
however, components of form b
created in form_load
function.
i use below code take screen shot of form b
generate empty form b
image without component of its.
bitmap b = new bitmap(1280, 720); formb.manualload(); formb.drawtobitmap(b, new rectangle(0, 0, 1280, 720)); b.save("d:\\test.bmp");
the manuaload() function in below.
public void manualload() { formb_load(null, null); formb_resize(null, null); invalidate(); }
how can fix problem?
i think
formb_load(null, null); , formb_resize(null, null);
ints hanler load , resize event's
next code work
bitmap b = new bitmap(1280, 720); var form = new formb(); form.visible = false; form.show(); form.drawtobitmap(b, new rectangle(0, 0, 1280, 720)); form.close(); b.save("d:\\test.bmp");
Comments
Post a Comment