在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1.保存文件对话框 SaveFileDialog saveFile = new SaveFileDialog(); saveFile.Title = "save file"; saveFile.AddExtension = true; saveFile.Filter = "file(*.cfg)|*.cfg|all file(*.*)|*.*"; saveFile.InitialDirectory = runPath; saveFile.FileName = "default.cfg"; if (saveFile.ShowDialog() == DialogResult.OK) { SaveDeviceDatas(saveFile.FileName); MessageBox.Show("保存成功!" + saveFile.FileName, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }
OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "cfg files(*.cfg)|*.cfg|All files|*.*"; openFileDialog.RestoreDirectory = true; openFileDialog.FilterIndex = 1; openFileDialog.InitialDirectory = runPath; openFileDialog.FileName = "default.cfg"; if (openFileDialog.ShowDialog() == DialogResult.OK) { LoadDeviceDataFromXML(openFileDialog.FileName); }
|
请发表评论