Hello Mat

 找回密码
 立即注册
查看: 7071|回复: 0

选择多个文件并加载显示listbox

[复制链接]

1294

主题

1520

帖子

110

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22633
发表于 2019-11-27 22:10:23 | 显示全部楼层 |阅读模式
选择多个文件并加载显示listbox
环境:WIN7 + Halcon12 + x86 + VS2013
  1. List<string> ImagePaths = new List<string>();
  2.             string ImagePath = null;
  3.             string ImagePathWithName = null;
  4.             OpenFileDialog openFileDialog = new OpenFileDialog();
  5.             openFileDialog.Multiselect = true;//可以选择多个选项
  6.             //openFileDialog.Filter = "JPEG文件|*.jpg*|BMP文件|*.bmp*|TIFF文件|*.tiff*";
  7.             openFileDialog.Filter = "所有图像文件 | *.bmp; *.pcx; *.png; *.jpg; *.gif;*.tif; *.ico; *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf";
  8.             if (openFileDialog.ShowDialog() == DialogResult.OK)
  9.             {
  10.                 foreach (string singleImagepath in openFileDialog.FileNames)
  11.                 {
  12.                     //选择了shape文件后
  13.                     ImagePath = System.IO.Path.GetDirectoryName(singleImagepath);
  14.                     ImagePathWithName = singleImagepath;
  15.                     ImagePaths.Add(ImagePathWithName);

  16.                     //this.listBox1.Items.Add(ImagePathWithName);
  17.                 }
  18.                 this.listBox1.DataSource = ImagePaths;
  19.                 //HTuple ImagePath = openFileDialog.FileName;
  20.                 //HOperatorSet.ReadImage(out ho_image, ImagePath);
  21.             }
复制代码











算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-4-20 21:48 , Processed in 0.220405 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表