DevExpress控件-TreeList使用总结
2016-04-25 09:49
465 查看
动态改变TreeList单元格样式
TreeList显示行号
若要添加单元格注释,则要用到toolTipController控件。将其拉入界面中,并将Treelist的 tooltipcontroller属性设置为刚才的控件名称,然后定义控件的GetActiveObjectInfo事件,本例显示了单元格的内容、列 和节点的索引:
private void TreeList1_CustomDrawNodeCell(object sender, CustomDrawNodeCellEventArgs e) { if (e.Column == 列名) { if (e.CellValue.ToString() != "XX值") { e.Appearance.BackColor = Color.Red; e.Appearance.Options.UseBackColor = true; e.Appearance.ForeColor = Color.Yellow; e.Appearance.Options.UseForeColor = true; } } }
TreeList显示行号
private void treeList1_CustomDrawNodeIndicator(object sender, CustomDrawNodeIndicatorEventArgs e) { TreeList tree = sender as DevExpress.XtraTreeList.TreeList; tree.IndicatorWidth = 30; DevExpress.Utils.Drawing.IndicatorObjectInfoArgs args = e.ObjectArgs as DevExpress.Utils.Drawing.IndicatorObjectInfoArgs; args.DisplayText = (tree.GetVisibleIndexByNode(e.Node) + 1).ToString(); }
若要添加单元格注释,则要用到toolTipController控件。将其拉入界面中,并将Treelist的 tooltipcontroller属性设置为刚才的控件名称,然后定义控件的GetActiveObjectInfo事件,本例显示了单元格的内容、列 和节点的索引:
private void ToolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) { if (e.SelectedControl is DevExpress.XtraTreeList.TreeList) { TreeList tree = (TreeList)e.SelectedControl; TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition); if (hit.HitInfoType == HitInfoType.Cell) { object cellInfo = new DevExpress.XtraTreeList.ViewInfo.TreeListCellToolTipInfo(hit.Node, hit.Column, null); string toolTip = string.Format("{0} (Colomn: {1}, Node ID: {2})", hit.Node[hit.Column], hit.Column.VisibleIndex, hit.Node.Id); e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip); } } }
相关文章推荐
- 易语言学习第二十课-----初认数组
- 自己实现的一个Native方法的调用
- c++ primer 学习笔记21类的定义和声明、隐含的this指针、类作用域
- 怎样引用显示百度地图
- git
- Windows Azure创建虚拟机
- arcgis 10.1 desktop安装oracle客户端,直连报错
- 手机里竟然有这么多传感器!终于都搞懂了
- UITableView取消多余的表格线条
- 写自己的ASP.NET MVC框架(下)
- finally关键字的理解
- windows下的redis 2.x 配置
- 图解侧方停车技巧2015高清版
- 写论文第三天:绘制初步策略的评估结果
- 剑指offer(4):从尾到头打印链表
- STM32相关网址学习
- 搜索算法总结
- SQLZOO(SELECT from WORLD Tutorial)Writeup
- C语言复习
- 写自己的ASP.NET MVC框架(上)