博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to Add a Binary Stream Image to ListView Columns
阅读量:7065 次
发布时间:2019-06-28

本文共 765 字,大约阅读时间需要 2 分钟。

In order to add image into ListView's column, you can implement it with the following steps:

1. Add the control ListView named lv and ImageList named imageList from ToolBox into the form.

2. Now assume that there is a binary stream fs:

FileStream fs = new FileStream("D:\\a.jpg", FileMode.Open);

3. Fill image stream into ImageList:

imageList.Images.Add(Image.FromStream(fs));

4. Set the list display mode:

lv.Items.Clear();lv.LargeImageList = imageList;lv.View = View.LargeIcon;

5. Add image into the ListView:

lv.BeginUpdate();ListViewItem lvi = new ListViewItem();lvi.ImageIndex = 0;lvi.Text = "pic" + 0;this.lv.Items.Add(lvi);this.lv.EndUpdate();

6. You can modify the image size by ImageList's Properties.

转载于:https://www.cnblogs.com/jizhiqiliao/p/9837681.html

你可能感兴趣的文章
常用的第三方库
查看>>
java 操作elasticsearch之搭建测试项目环境
查看>>
iOS-图文表并茂,手把手教你GCD
查看>>
python之logging模块
查看>>
让Android Studio支持系统签名
查看>>
quick 状态机StateMachine
查看>>
Node学习5-events模块
查看>>
3.5 Templates -- Binding Element Attributes(绑定元素属性)
查看>>
jquery常用技巧及常用方法列表集合
查看>>
Microsoft Dynamics AX 2012 正式版虚拟机
查看>>
iOS-CALayer图片淡入淡出动画
查看>>
Python学习笔记
查看>>
Oracle
查看>>
nodejs package.json说明
查看>>
MAT(MemoryAnalyzerTool)
查看>>
分享实用的JavaScript代码库
查看>>
46. Permutations
查看>>
49. Group Anagrams
查看>>
团队作业7——第二次项目冲刺-Beta版本项目计划
查看>>
lazyMan
查看>>