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

    打开文件代码:

        OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Title = "选择数据源文件";
                openFileDialog.Filter = "txt文件|*.txt";
                openFileDialog.FileName = string.Empty;
                openFileDialog.FilterIndex = 1;
                openFileDialog.Multiselect = false;
                openFileDialog.RestoreDirectory = true;
                openFileDialog.DefaultExt = "txt";
                if (openFileDialog.ShowDialog() == false)
                {
                    return;
                }
               string  txtFile = openFileDialog.FileName;

    打开文件夹代码:

        System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
                folderBrowserDialog.Description = "选择Word文档生成的文件夹";
                folderBrowserDialog.ShowNewFolderButton = false;
                folderBrowserDialog.RootFolder = Environment.SpecialFolder.Personal;
                folderBrowserDialog.ShowDialog();
                if (folderBrowserDialog.SelectedPath == string.Empty) 
                {
                    return;
                }
                string wordFolder = folderBrowserDialog.SelectedPath;

  • 相关阅读:
    Linux进入单用户模式(passwd root修改密码)
    stark组件的分页,模糊查询,批量删除
    stark组件的增删改(新)
    stark组件的增删改
    stark组件之展示数据(查)
    stark组件配置,二层URL
    单例模式及设计url分发
    Django之modelform
    rbac组件权限按钮,菜单,可拔插
    rbac权限+中间件
  • 原文地址:https://www.cnblogs.com/alsofly/p/3373904.html
Copyright © 2011-2022 走看看