c#winform选择文件,文件夹,打开指定目录方法
来源:互联网 发布:荆州网络电视垄上行 编辑:程序博客网 时间:2024/06/05 02:19
private void btnFile_Click(object sender, EventArgs e)
{
OpenFileDialog fileDialog = new OpenFileDialog();
fileDialog.Multiselect = true;
fileDialog.Title = "请选择文件";
fileDialog.Filter="所有文件(*.*)|*.*";
if (fileDialog.ShowDialog() == DialogResult.OK)
{
string file=fileDialog.FileName;
MessageBox.Show("已选择文件:" + file,"选择文件提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void btnPath_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
string foldPath = dialog.SelectedPath;
MessageBox.Show("已选择文件夹:" + foldPath, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btnOpen_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer.exe","c:\\windows");
}
{
OpenFileDialog fileDialog = new OpenFileDialog();
fileDialog.Multiselect = true;
fileDialog.Title = "请选择文件";
fileDialog.Filter="所有文件(*.*)|*.*";
if (fileDialog.ShowDialog() == DialogResult.OK)
{
string file=fileDialog.FileName;
MessageBox.Show("已选择文件:" + file,"选择文件提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void btnPath_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
string foldPath = dialog.SelectedPath;
MessageBox.Show("已选择文件夹:" + foldPath, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btnOpen_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer.exe","c:\\windows");
}
阅读全文
0 0
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- C# winform选择文件,文件夹,打开指定目录方法
- c#winform打开指定目录的方法
- 打开文件夹,定位指定文件[c# WinForm]
- C#WinForm打开文件夹并选中文件
- C# winform打开文件夹并选中指定文件
- WinForm 文件/文件夹选择
- 打开一个树型目录选择文件夹(不选择文件)
- C# WINFORM 编程中,选择**文件夹**而不是文件的方法
- C#选择文件、选择文件夹、打开文件夹
- 打开指定目录 and 打开指定文件
- java中打开指定文件夹及读取文件方法
- 批处理 选择打开指定的文件夹
- 打开选择文件夹或文件
- Android_Framework_WindowManagerService_总述
- Python 爬虫简单实战之CSDN
- Python初学笔记
- CDQ分治--模板 BZOJ 3262--陌上花开【三维偏序】
- bootstrap-markdown使用
- c#winform选择文件,文件夹,打开指定目录方法
- Android屏幕适配问题
- Android的数据存储之SharedPreference与文件File
- Array----- 120. Triangle(计算路径最小和)
- LeetCode 448. Find All Numbers Disappeared in an Array
- 前端、Vue.js和SVG的一些知识
- 实用的60个CSS代码片段
- tomcat 提交war任务及idea配置tomcat
- Ubuntu 16.04 安装Sublime Text 3