winfrom笔记
电脑版发表于:2021/9/23 11:38
前言
winfrom笔记
winfrom 打开文件
借助openFileDialog类
直接拖控件,也可以直接实例化这个类
private void button1_Click(object sender, EventArgs e) { openFileDialog1.Multiselect = true;//该值确定是否可以选择多个文件 openFileDialog1.Title = "请选择文件夹"; openFileDialog1.Filter = "所有文件(*.*)|*.*"; if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string file = openFileDialog1.FileName; } }
达到就是这个效果