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;

  • 相关阅读:
    Unreal Engine 4 Based Materials
    PhysX Clothing for UE4
    UE4中使用URL图片
    开始创作自己的VR作品——VR故事叙述终极指南
    UE4里的自定义深度功能
    Mybatis27题
    java 备用待迁移
    几个算法题目
    数据结构算法题目
    Mybatis 面试题
  • 原文地址:https://www.cnblogs.com/alsofly/p/3373904.html
Copyright © 2011-2022 走看看