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
Post a Comment