得到文件夹中选定的文件名Function
作者:互联网
static container GetMultiselectFileName(FileNameFilter filter, str formTitle = "请选择符合条件的文件:"){ str filterStr,fileNameStr; container fileNameCon; int i,j,irow; int conCount = conlen(filter); System.String[] fileName; System.Windows.Forms.OpenFileDialog od = new System.Windows.Forms.OpenFileDialog(); ; if (!conCount) throw error("参数错误"); for (i = 1;i <= conCount;i++) { if (i == 1) filterStr = conpeek(filter,i); else filterStr += "|" + conpeek(filter,i); } od.set_Title(formTitle); od.set_Multiselect(true); od.set_Filter(filterStr); if (od.ShowDialog()) { fileName = od.get_FileNames(); irow = fileName.get_Length(); } if (!irow) continue; for (j = 1;j <= irow;j++) { fileNameStr = ""; fileNameStr = fileName.GetValue(j-1); fileNameCon += [fileNameStr]; } return fileNameCon;}
标签:Function,od,文件名,fileNameStr,filterStr,fileName,filter,文件夹,irow 来源: https://www.cnblogs.com/xtwkh1973/p/10997306.html