c# - Saving image from PictureBox after drawing to it -


i have picturebox image , use paint event draw line on , when save image, image without line been drawn

    private void picbox_paint(object sender, painteventargs e)     {         e.graphics.drawline(pen, end, start);         e.graphics.flush();         e.graphics.save();     }   //and save picbox.image.save("directory"); 

what missing here?

you want drawtobitmap() method:

    private void button1_click(object sender, eventargs e)     {         bitmap bmp = new bitmap(picbox.clientsize.width, picbox.clientsize.height);         picbox.drawtobitmap(bmp, picbox.clientrectangle);         bmp.save("...filename here...");     } 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -