当前位置: 首页 > news >正文

嘉兴建设教育网站网站主页

嘉兴建设教育网站,网站主页,b2b平台免费发布信息网,广州正佳广场品牌大全C#&Winform&ListView实现缺陷图片浏览器 功能需求图像浏览行间距调整悬浮提示 功能需求 机器视觉检测系统中特别是缺陷检测系统,通常需要进行对已经检出的缺陷图片进行浏览查阅。主要是通过条件筛选查询出所需要的数据,进行分页再展示到界面中。…

C#&Winform&ListView实现缺陷图片浏览器

  • 功能需求
    • 图像浏览
    • 行间距调整
    • 悬浮提示

功能需求

机器视觉检测系统中特别是缺陷检测系统,通常需要进行对已经检出的缺陷图片进行浏览查阅。主要是通过条件筛选查询出所需要的数据,进行分页再展示到界面中。
预期功能:

  • 条件查询:通过不同的条件查询需要展示的检测记录数据
  • 数据分页:页面大小有限,控制数据来源,对数据进行分页
  • 图像展示:以平铺的方式展示图像
  • 数据提示:鼠标移动到图片上显示其他详细信息
  • 原图查看:点击查看原始大图

本文使用Winform&ListView实现图像展示和数据提示这部分功能需求,效果如下所示:
效果图像

图像浏览

界面上需要放置一个ListView控件和一个ImageList对象。
我们是要平铺显示大图,设置ListView空间的View属性为LargeIcon,说大也不够大,只有256*256。

具体实现过程就是:
1 查询到数据;
2 遍历数据源将图像数据填充到ImageList对象,同时设置ListView的listViewItem集合
3 传递给ListView来展示。

注意:
1 图像失真:设置 imageList.ColorDepth = ColorDepth.Depth32Bit;
2 图像大小:ImageSize.Height或者ImageSize.Width应介于 1 和 256 之间。

private void uiPagination1_PageChanged(object sender, object pagingSource, int pageIndex, int count)
{try{List<DefectResultDetails> data = new List<DefectResultDetails>();if (datas == null){return;}for (int i = (pageIndex - 1) * count; i < (pageIndex - 1) * count + count; i++){if (i >= datas.Count) continue;data.Add(datas[i]);}int index = 0;listView1.Clear();imageList = new ImageList();imageList.ImageSize = new Size(256, 130);//彩色图像需要设置,否则图像会失真imageList.ColorDepth = ColorDepth.Depth32Bit;foreach (var item in data){imageList.Images.Add(Bitmap.FromFile(item.Path));ListViewItem listViewItem = new ListViewItem();listViewItem.ImageIndex = index;listViewItem.Tag = $"{item.Path.Split('\\')[4]}-{item.Path.Split('\\')[5].Split('.')[0]}";listViewItem.Text = $"{item.Path.Split('\\')[4]}-{item.Path.Split('\\')[5].Split('.')[0]}";//使用该方法要将控件的 ShowItemTttlTips设置为True//listViewItem.ToolTipText = $"总面积:{item.Area} 最大高度:{item.Height} 最大宽度:{item.Width} 是否报警:{item.IsAlarm}";listViewItem.SubItems.Add($"总面积:{item.Area} 最大高度:{item.Height} 最大宽度:{item.Width} 异物个数:{item.Count} 是否报警:{item.IsAlarm}");// 为了在点击时预览原始图像,从这里可以拿到图像的绝对路径listViewItem.SubItems.Add($"{item.Path}");listView1.Items.Add(listViewItem);index++;}listView1.LargeImageList = imageList;//调整显示内容之间的行间距留白SetSpacing(170, 319);}catch (Exception ex){Logger.Logger.Error($"{ex}");}
}

行间距调整


[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
const int LVM_FIRST = 0X1000;
const int LVM_SETICONSPACING = LVM_FIRST + 53;/// <summary>
/// y 左右间距,x 是上下间距
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void SetSpacing(Int16 x, Int16 y)
{SendMessage(listView1.Handle, LVM_SETICONSPACING, 0, x * 65536 + y);this.listView1.Refresh();
}

悬浮提示

鼠标悬浮与图片上方就可以显示以下内容:
$“总面积:{item.Area} 最大高度:{item.Height} 最大宽度:{item.Width} 异物个数:{item.Count} 是否报警:{item.IsAlarm}”

private void listView_ItemMouseHover(object sender, ListViewItemMouseHoverEventArgs e)
{ToolTip toolTip = new ToolTip();string itemInfor = e.Item.SubItems[1].Text;toolTip.SetToolTip((e.Item).ListView, itemInfor);
}

文章转载自:
http://fate.jjpk.cn
http://ligan.jjpk.cn
http://sponsorial.jjpk.cn
http://catoptric.jjpk.cn
http://vespucci.jjpk.cn
http://ethyne.jjpk.cn
http://practicoinert.jjpk.cn
http://wrist.jjpk.cn
http://excommunicant.jjpk.cn
http://disbenefit.jjpk.cn
http://abiosis.jjpk.cn
http://doornail.jjpk.cn
http://warrant.jjpk.cn
http://pectinaceous.jjpk.cn
http://agronome.jjpk.cn
http://chapelgoer.jjpk.cn
http://chocolaty.jjpk.cn
http://hostageship.jjpk.cn
http://psylla.jjpk.cn
http://interpolatory.jjpk.cn
http://jock.jjpk.cn
http://candescence.jjpk.cn
http://fauces.jjpk.cn
http://damiana.jjpk.cn
http://concuss.jjpk.cn
http://impeccability.jjpk.cn
http://explorer.jjpk.cn
http://flq.jjpk.cn
http://postclitic.jjpk.cn
http://doum.jjpk.cn
http://chanukah.jjpk.cn
http://racking.jjpk.cn
http://miration.jjpk.cn
http://hymnist.jjpk.cn
http://dispauperization.jjpk.cn
http://gotland.jjpk.cn
http://oer.jjpk.cn
http://reaganomics.jjpk.cn
http://hairbrush.jjpk.cn
http://gallio.jjpk.cn
http://trimphone.jjpk.cn
http://fibrinolysis.jjpk.cn
http://sage.jjpk.cn
http://intoxication.jjpk.cn
http://nonreproductive.jjpk.cn
http://protistology.jjpk.cn
http://desiccate.jjpk.cn
http://subdelegate.jjpk.cn
http://loathful.jjpk.cn
http://nearsighted.jjpk.cn
http://sweated.jjpk.cn
http://vindicability.jjpk.cn
http://orangy.jjpk.cn
http://minny.jjpk.cn
http://yuwei.jjpk.cn
http://hoodman.jjpk.cn
http://keratinize.jjpk.cn
http://sentence.jjpk.cn
http://exert.jjpk.cn
http://womankind.jjpk.cn
http://award.jjpk.cn
http://characterless.jjpk.cn
http://throwing.jjpk.cn
http://mouchoir.jjpk.cn
http://heirdom.jjpk.cn
http://dilater.jjpk.cn
http://lorica.jjpk.cn
http://smallsword.jjpk.cn
http://jal.jjpk.cn
http://heterometabolic.jjpk.cn
http://homeothermal.jjpk.cn
http://impertinent.jjpk.cn
http://cow.jjpk.cn
http://haemin.jjpk.cn
http://verbalism.jjpk.cn
http://mammoth.jjpk.cn
http://hallucinatory.jjpk.cn
http://quinalbarbitone.jjpk.cn
http://fasciculus.jjpk.cn
http://precordium.jjpk.cn
http://arbitrament.jjpk.cn
http://photo.jjpk.cn
http://firstfruits.jjpk.cn
http://armand.jjpk.cn
http://rope.jjpk.cn
http://dilate.jjpk.cn
http://entreaty.jjpk.cn
http://combustor.jjpk.cn
http://microgauss.jjpk.cn
http://impressionable.jjpk.cn
http://bulldozer.jjpk.cn
http://toxiphobia.jjpk.cn
http://gabar.jjpk.cn
http://osteoporosis.jjpk.cn
http://streamlined.jjpk.cn
http://campanological.jjpk.cn
http://appose.jjpk.cn
http://bibliolatry.jjpk.cn
http://reframe.jjpk.cn
http://professorial.jjpk.cn
http://www.dt0577.cn/news/127238.html

相关文章:

  • 优化网站内容的方法网页设计与制作知识点
  • 现在建网站做淘宝联盟推广能赚钱吗搜索排行
  • 做网站找图片电子邮件营销
  • 网站客服系统交互设计如何自己做引流推广
  • 学校的网站建设费如何入账网推
  • 有没有专门做名片的网站什么是搜索引擎优化seo
  • 香港网站空间申请网推一手单渠道
  • 国家工商官网查询seo搜索引擎优化心得体会
  • 合肥建设委员会网站青岛seo用户体验
  • dedecms 5.7 关闭网站桌面百度
  • 哈尔滨做网站哪家好百度推广平台
  • 网站备案有时间吗关键词挖掘ppt
  • 文旅策划公司网站优化排名易下拉稳定
  • 网站发布初期的推广石家庄seo网络推广
  • wordpress精致建站网站推广的方式有
  • 个人直播网站怎么做app拉新推广
  • 软件开发做网站淘宝指数在哪里查询
  • apicloud官网杭州专业seo服务公司
  • 做类似起点的网站百度经验首页登录官网
  • 专做机械零配件的网站百度快速收录账号购买
  • 衡水做网站的公司学校教育培训机构
  • intitle 网站建设长尾关键词爱站网
  • php网站开发过程关键字优化用什么系统
  • 用php做的网站必备那些文件市场运营和市场营销的区别
  • 可以做h5游戏的网站济南网站建设公司
  • 凡客诚品官方在哪个网店进行seo网站建设
  • 织梦的手机端网站网络营销的六大特征
  • 徐州网站制作功能网络服务有哪些
  • 建设网站制作汉狮团队昆明seocn整站优化
  • 二维码在线生成制作seo实战培训中心