1、
OpenFileDialog openImageDialog = new OpenFileDialog(); openImageDialog.Filter = "Image Files (*.jpg;*.png)|*.jpg;*.png"; openImageDialog.Multiselect = false; if (openImageDialog.ShowDialog() == DialogResult.OK) { MessageBox.Show(openImageDialog.FileName); } else { }
SaveFileDialog saveImageDialog = new SaveFileDialog(); saveImageDialog.Filter = "Image Files (*.jpg;*.png)|*.jpg;*.png"; //openImageDialog.Multiselect = false; if (saveImageDialog.ShowDialog() == DialogResult.OK) { MessageBox.Show(saveImageDialog.FileName); } else { }
2、文件夹选择对话框
FolderBrowserDialog folderDlg = new FolderBrowserDialog(); if(folderDlg.ShowDialog()==DialogResult.OK) MessageBox.Show(folderDlg.SelectedPath);
---恢复内容结束---