ObjectListView的使用
来源:互联网 发布:新人程序员简历 编辑:程序博客网 时间:2024/06/10 04:53
1.引入ObjectListView.dll
2.使用
把objectlistview拖入到窗体
加入列,
objectlistview显示数据必须要和一个对象绑定,objectListView1.SetObjects(object);
而每一列的显示对应一个成员变量
aspectName必须与object的成员变量Title关联,才可以显示出数据,所以,aspectName栏必须填入Title。
加入过程:
MyObject myObject = new MyObject();
myObject.nameString = "yrf";
myObject.ageString = "12";
List<MyObject> list = new List<MyObject>();
list.Add(myObject);
objectListView1.SetObjects(list);
是否显示组:
this.olvComplex.ShowGroups = false;
当鼠标放在某一行,颜色会改变的效果
this.olvSimple.UseHotItem = true;
this.olvSimple.HotItemStyle = this.hotItemStyle1;
OLVColumn增加一列,表格中的一列
olvJokeColumn
加入图片
1.ObjectListView‘s SmallImageList
2.
this.titleColumn.ImageGetter = delegate (object rowObject) {
Song s = (Song)rowObject;
if (s.Rating >= 80)
return "star";
else
return "song";
};
加入checkbox:
1.this.olvComplex.OwnerDraw = true;
2.this.olvComplex.UseSubItemCheckBoxes = true;
3.this.olvJokeColumn.CheckBoxes = true;
4.响应事件:SubItemChecking
改变某一列的颜色和字体:
To change the formatting of an individual cell, you need to setUseCellFormatEvents totrue and then listen forFormatCell events.To show just the credit balance in red, you could do something like this:
private void olv1_FormatCell(object sender, FormatCellEventArgs e) { if (e.ColumnIndex == this.creditBalanceColumn.Index) { Customer customer = (Customer)e.Model; if (customer.Credit < 0) e.SubItem.ForeColor = Color.Red; }}
行高:
RowHeight
去掉头部:
headstyle
改变头部样式:
Make sure HeaderUsesThemes is false
HeaderFormatStyle
点击行事件的响应:
1.Click事件
2.objectListView1.HotRowIndex
改变表格头部的颜色:
The colours used to indicate a selected row are governed by the operating system andcannot be changed. However, if you setUseCustomSelectionColors to true, theObjectListView will use HighlightBackgroundColor andHighlightForegroundColor asthe colours for the selected rows.
- ObjectListView的使用
- ObjectListView控件中的BUG
- GUID使用的使用
- ${}的使用
- 的使用
- @[],@()的使用
- ->的使用
- +、-、*、/、%的使用
- &&的使用
- %:的使用
- Makefile中使用$$的使用
- Makefile中使用$$的使用
- Red5的使用--使用日志
- prefernce的使用具体使用
- 【工具使用】git 的使用
- 关于使用AsyncTaskLoader的使用
- 使用CABasicAnimation的基本使用
- 使用RocketMQ的客户端使用
- 为何在设备上运行时无法保存数据到应用bundle中
- C与C++混合编程的再度讨论
- 改善Objective-C的日志输出
- 自己比较喜欢的几句话,激励自己的IT生涯继续前进
- hdoj 2094 谁是冠军
- ObjectListView的使用
- 集训队论文之经典数学题【收藏】
- 周迅 演绎“不老传说” (图)
- Segmentation fault
- Hibernate映射Person类
- iptables/netfilter详解中文手册
- C++11 多线程
- Hibernate多次映射同一个类
- Android图片处理(Matrix,ColorMatrix)