标签:
1.弹出窗体选择本地文件-OpenFileDialog
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "窗体左上角标题";//窗体左上角标题
openFileDialog.ShowHelp = true;//显示帮助按钮
openFileDialog.Filter = "文本文件(.txt)|*.txt|JPG文件(.jpg)|*.jpg|所有文件|*.*"; //过滤文件格式
openFileDialog.FilterIndex = 3;//格式索引 从1开始 1:文本文件 2:JPG文件 3:所有文件
openFileDialog.InitialDirectory = @"C:\";//第一次打开的默认路径
openFileDialog.Multiselect = false;//文件是否能多选
//openFileDialog.DefaultExt = ".txt";//设置或获取文件扩展名
//选择好文件后点击OK按钮
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
}
效果图:

标签:
原文地址:http://www.cnblogs.com/zhyue93/p/WinForm_Popups.html