本文介绍了如何在不显示SaveFileDialog的情况下保存快照?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
各位大家好,我想从网络摄像头拍摄快照并将其保存在给定的路径中。网络摄像头应该在给定的时间段后启动。这是我试过的代码正常但我不需要弹出的代码文件保存时保存SaveFileDialog。如何在不显示SaveFileDialog的情况下保存快照?请帮助.....
Hello everybody,I want to take snapshot from the webcam and save it in a given path.The webcam should start after a given time period.This is the code I have tried it works properly but I don't need to popup SaveFileDialog when the file is saving.How do I save the 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);
}
}
推荐答案
这篇关于如何在不显示SaveFileDialog的情况下保存快照?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!