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;
WPF 打开文件、文件夹的更多相关文章
- WPF 打开指定文件路径的文件资源管理器
x 需求是想让WPF打开一个指定文件路径的文件夹,但是搜出来的八成都是<打开文件>的这样的↓ Microsoft.Win32.OpenFileDialog open_file = new ...
- 在WPF中使用文件夹选择对话框
开发中有时会想实现"选择某个文件夹"的效果: 在WPF中,使用Microsoft.Win32.OpenFileDialog只能选择文件,FolderBrowserDialog只能用 ...
- myeclipse,eclipse打开当前文件所在文件夹
方法一: eclipse打开当前文件所在文件夹的插件Run-->External Tools-->External Tools Configurations...new 一个 progra ...
- 在Eclipse 中打开当前文件夹
最近试过好多次,安装插件来 在Eclipse 中打开当前文件所在文件夹,结果总是不甚如意. 烦躁了,决定还是不要使用插件了!!! 1.打开Eclipse,点击菜单栏上的Run--External To ...
- C#项目打开/保存文件夹/指定类型文件,获取路径
C#项目打开/保存文件夹/指定类型文件,获取路径 转:http://q1q2q363.xiaoxiang.blog.163.com/blog/static/1106963682011722424325 ...
- [转]C#中调用资源管理器(Explorer.exe)打开指定文件夹 + 并选中指定文件 + 调用(系统默认的播放类)软件(如WMP)打开(播放歌曲等)文件
原文:http://www.crifan.com/csharp_call_explorer_to_open_destinate_folder_and_select_specific_file/ C#中 ...
- Eclipse添加小工具_打开当前文件所在文件夹
CopyRight yuhuashi http://www.cnblogs.com/chuyuhuashi/archive/2012/05/06/2485831.html 默认情况下使用eclip ...
- 【技术贴】Eclipse 右键打开当前文件所在文件夹
1.使用插件,百度:OpenExplorer_1.5.0.v201108051513.jar 2.默认情况下使用eclipse打开当前文件所在文件夹很麻烦,需要右键点击 Package Explore ...
- 怎样使用windows命令行,用notepad打开某文件夹下面的所有文件
http://zhidao.baidu.com/question/2138815012359999388.html __________________________________________ ...
- Eclipse 打开当前文件所在的文件夹
两种方法: 1.安装EasyExplorer插件,有了这个插件就可以很方便地打开资源文件所在的文件夹了. EasyExplorer 从 http://sourceforge.net/projects/ ...
随机推荐
- DSP using MATLAB 示例 Example3.15
上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...
- PHP 二分查找(详细)
<?php // PHP 二分查找 function search($arr, $sea){ $low = 0; // 确定数组的开始的下标 $len ...
- node express新项目默认主文件app.js
var express = require('express'); var path = require('path'); var favicon = require('serve-favicon') ...
- hdu 1114 Piggy-Bank
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission( ...
- Webstorm & PhpStorm
WebStorm注册码 User Name: EMBRACE License Key: ===== LICENSE BEGIN ===== 24718-12042010 00001h6wzKLpfo3 ...
- Delphi中Messagedlg用法
if MessageDlg('Welcome to my Delphi application. Exit now?', mtConfirmation, [mbYes, mbNo], 0) = mrY ...
- 操作TAB文件和TStringGrid赋值;
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- UVa1515 Pool construction(最小割)
题目 Source https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...
- DrawingContext.Pop Method
The following example shows the effect of the Pop command. using System; using System.Windows; using ...
- BZOJ4435 : [Cerc2015]Juice Junctions
最大流=最小割,而因为本题点的度数不超过3,所以最小割不超过3,EK算法的复杂度为$O(n+m)$. 通过分治求出最小割树,设$f[i][j][k]$表示最小割为$i$时,$j$点在第$k$次分治过程 ...