OpenFileDialog ofd = new OpenFileDialog();
//设置标题
ofd.Title = "选择文件";
//是否保存上次打开文件的位置
ofd.RestoreDirectory = true;
//默认打开位置
ofd.InitialDirectory = "c:\\" ;
//图片文件对应多种格式
//文本文件对应一种格式
ofd.Filter = "图片文件|*.jpg;*.bmp;*.gif|文本文件|*.txt";

if (ofd.ShowDialog() == DialogResult.OK)
{
    MessageBox.Show(ofd.FileName);
}

 

相关文章:

  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2021-11-22
猜你喜欢
  • 2021-08-25
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
相关资源
相似解决方案