c# - Allow user to copy image from picturebox and save it everywhere -


in application have picturebox shows image. when user right clicks on picturebox , selects copy context menu, want copy image clipboard user can paste in folders , anywhere else. how can that?

edit: use code user can paste image word.

var img = image.fromfile(pnlcontent_picture_picturebox.imagelocation); clipboard.setimage(img); 

clipboard.setimage copies image content (binary data) clipboard not file path. paste file in windows explorer need have file paths collection in clipboard not content.

you can add path of image file stringcollection , call setfiledroplist method of clipboard achieve want.

system.collections.specialized.stringcollection filecollection = new system.collections.specialized.stringcollection(); filecollection.add(pnlcontent_picture_picturebox.imagelocation); clipboard.setfiledroplist(filecollection); 

now user can past file anywhere e.g. windows explorer.

more info on clipboard.setfiledroplist method http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.setfiledroplist.aspx


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -