我使用此代码打开文件夹并从中浏览文件,但我需要在没有打开文件夹的情况下获取这些文件,当我运行我的程序时会自动加载这些文件,我尝试使用GetFiles()
但在应用过滤器时没有与我一起使用对于我要选择的文件,
这是我的代码
OpenFileDialog dlg = new OpenFileDialog();
dlg.InitialDirectory = @"C:\Users\ahmed\Desktop\samples";
dlg.Filter = "Gestures (*.xml)|*.xml";
dlg.Title = "Load Gestures";
dlg.RestoreDirectory = false;
dlg.Multiselect = true;
if (dlg.ShowDialog(this) == DialogResult.OK)
{
for (int i = 0; i < dlg.FileNames.Length; i++)
{
string name = dlg.FileNames[i];
_rec.LoadGesture(name);
}
ReloadViewForm();
}