c# 打开、保存文件对话框 和 文件夹选择对话框

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);

---恢复内容结束---

posted @ 2015-11-26 16:59  lwn6  阅读(4243)  评论(0编辑  收藏  举报
什么是幸福?天天在做自己想做的事情,家人、同事、朋友、客户、网友都和和睦睦,身体健康、钱包鼓鼓、女朋友天天开心、生活无忧无虑就是最大的幸福