选择1个文件夹并加载显示全部文件到listbox
选择1个文件夹并加载显示全部文件到listbox环境:WIN7 + Halcon12 + x86 + VS2013
HTuple hv_path = null, hv_ImageFiles = null;
string FilePath = null, ImagePathWithName = null;
List<string> ImagePaths = new List<string>();
// Initialize local and output iconic variables
FolderBrowserDialog FilesPath = new FolderBrowserDialog();
if (FilesPath.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FilePath = FilesPath.SelectedPath;
hv_path = FilePath;
Halcon12Funs.list_image_files(hv_path, "default", new HTuple(), out hv_ImageFiles);
for (int i = 0; i <= (int)((new HTuple(hv_ImageFiles.TupleLength())) - 1); i++)
{
ImagePathWithName = hv_ImageFiles.TupleSelect(i);
ImagePaths.Add(ImagePathWithName);
this.listBox1.Items.Add(ImagePathWithName);
}
}
页:
[1]