zoukankan      html  css  js  c++  java
  • 打开文件,文件夹

    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. }  
  • 相关阅读:
    web&http协议&django初识
    jQuery
    BOM&DOM
    装饰器
    JavaScript
    模块
    面向对象编程
    函数
    CSS
    HTML
  • 原文地址:https://www.cnblogs.com/zhangruifeng/p/5975830.html
Copyright © 2011-2022 走看看