首页 > 其他 > 详细

打开文件,文件夹

时间:2016-10-19 07:42:44      阅读:247      评论:0      收藏:0      [点我收藏+]
  1. private void btnFile_Click(object sender, EventArgs e)  
  2. {  
  3. OpenFileDialog fileDialog = new OpenFileDialog();  
  4. fileDialog.Multiselect = true;  
  5. fileDialog.Title = "请选择文件";  
  6. fileDialog.Filter="所有文件(*.*)|*.*";  
  7. if (fileDialog.ShowDialog() == DialogResult.OK)  
  8. {  
  9. string file=fileDialog.FileName;  
  10. MessageBox.Show("已选择文件:" + file,"选择文件提示",MessageBoxButtons.OK,MessageBoxIcon.Information);  
  11. }  
  12. }  
  13.   
  14. private void btnPath_Click(object sender, EventArgs e)  
  15. {  
  16. FolderBrowserDialog dialog = new FolderBrowserDialog();  
  17. dialog.Description = "请选择文件路径";  
  18. if (dialog.ShowDialog() == DialogResult.OK)  
  19. {  
  20. string foldPath = dialog.SelectedPath;  
  21. MessageBox.Show("已选择文件夹:" + foldPath, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  22. }  
  23. }  
  24.   
  25. private void btnOpen_Click(object sender, EventArgs e)  
  26. {  
  27. System.Diagnostics.Process.Start("Explorer.exe","c:\\windows");  
  28. }  

打开文件,文件夹

原文:http://www.cnblogs.com/zhangruifeng/p/5975830.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!