c# - How to save snapshot without showing SaveFileDialog? -


i want take snapshot webcam , save in given path.the webcam should start after given time period.this code have tried works don't need popup savefiledialog when file saving.how save snapshot without showing savefiledialog? please help.....

private void btnstartpic_click(object sender, eventargs e)     {         int delay = convert.toint32(numericupdown1.value);         int miliseconds = delay * 1000;         thread.sleep(miliseconds);         this.refresh();          cm = new videocapturedevice(wcam[cmbdevice.selectedindex].monikerstring);         cm.newframe += new newframeeventhandler(cam_newframe);         cm.start();          string path = txtbrowse.text;          string currentdatetime = string.format("text-{0:yyyy-mm-dd_hh-mm-ss-tt}.bin", datetime.now);          savefiledialog s = new savefiledialog();         s.filename = currentdatetime + ".jpg";         s.defaultext = ".jpg";         s.filter = currentdatetime + "(.jpg)|*.jpg";           s.initialdirectory = @path;          if (s.showdialog() == dialogresult.ok)         {              picturebox1.image.save(s.filename);          }        } 

you have answer yourself:

picturebox1.image.save(s.filename); 

the first parameter file name, can provide string if want.

samples:

picturebox1.image.save(@"c:\test\picture.jpg");  picturebox1.image.save(path.combine("folder", "filename"));  string s = ...  picturebox1.image.save(s); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -