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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -