1.打开单个文件,获取文件名
private void On_Click()
{
string filename="";
OpenFileDialog Dialog = new OpenFileDialog();
Dialog.Filter = "(*.ifc)|";
if (Dialog.ShowDialog() == DialogResult.OK)
{
filename = Path.GetFileNameWithoutExtension(Dialog.FileName);
}
else
{
MessageBox.Show("未选择");
}
}
2.打开文件夹,获取文件名路径
private void On_Click()
{
string[] filepath=null;
FolderBrowserDialog Dialog = new FolderBrowserDialog();
Dialog.Description = "";
if (Dialog.ShowDialog() == DialogResult.OK)
{
str = Dialog.SelectedPath;
filepath = Directory.GetFiles(@str, "*.ifc");
}
else
{
MessageBox.Show("未选择");
}
}
3.弹出界面,获取界面选择信息内容
private void On_Click()
{
Form form = new Form();
string[] DQ_files = null;
DialogResult str = form.ShowDialog();
if (str == DialogResult.OK)
{
DQ_files = form.files.Split('@');
}
else
{
MessageBox.Show("未选择");
}
}