c# - How to load a image into a picture box? -
i programming in c# , have can select files phone text:
private void button_click_2(object sender, routedeventargs e) { var fileopenpicker = new windows.storage.pickers.fileopenpicker(); fileopenpicker.viewmode = windows.storage.pickers.pickerviewmode.list; fileopenpicker.filetypefilter.add(".jpg"); fileopenpicker.filetypefilter.add(".jpeg"); fileopenpicker.filetypefilter.add(".png"); fileopenpicker.picksinglefileandcontinue();
how can let picture popup in picturebox?
use filedialog
, load bitmap selected path:
using (openfiledialog dlg = new openfiledialog()) { dlg.title = "open image"; dlg.filter = "bmp files (*.bmp)|*.bmp"; if (dlg.showdialog() == dialogresult.ok) { // create new bitmap object picture file on disk, // , assign picturebox.image property picturebox1.image = new bitmap(dlg.filename); } }
Comments
Post a Comment