当前位置: 移动技术网 > IT编程>开发语言>c# > DevExpress TreeList 常见问题解决方法

DevExpress TreeList 常见问题解决方法

2019年07月18日  | 移动技术网IT编程  | 我要评论

1、 如何给节点添加图片? 首先需要添加一个图片控件,然后给它加入图片,最后把treelist的节点图片属性和图片控件绑定,代码如下:

imagelist imagelist;
private void 测试窗口_load(object sender, eventargs e) 
{
con.connectionstring = sqlconstr; 
datatable dt = new datatable; 
dt.columns.add("进程");
dt.rows.add("123");
treelist1.dock = dockstyle.fill;
treelist1.datasource = dt; 
imagelist = new imagelist; 
imagelist.images.add(image.fromfile(@"e:\图片素材\2.jpg")); 
treelist1.selectimagelist = imagelist; 
treelist1.nodes[0].imageindex = 0;
}

2、 如何将背景色设为透明?

treelist1.backcolor = color.transparent; 
treelist1.appearance.empty.backcolor = color.transparent; 
treelist1.appearance.row.backcolor = color.transparent;

3、 如何展开当前节点和父节点?

/// <summary>
/// 展开当前节点及父节点
/// </summary>
/// <param name="_node">
public void parentnodeexpend(treelistnode _node)
{
  treelistnode _cnode = _node;
  treelist1..nodes.treelist.findnodebyid(_cnode.id).expanded = true;

4、 如何设置显示水平滚动条?

public void treelisthorzscroll(treelist treelist)
{
treelist.optionsview.autowidth = false;

下面看下devexpress常见问题解决方案

layoutcontrol:

   1.lookandfeel。

   2.optionsview 之 allowhottrack【鼠标放上去变色】,drawitemborders【控件边框是否显示】

   3.begininvoke(new methodinvoker(delegate { textedit1.focus()})); 【获取焦点】

   4.layoutcontrol1.optionsitemtext.textalignmode=aligninlayoutcontrol.(设置拖放控件后,控件自动跟原有内容调整)查看图片

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

gridview :

  1.属性 indicatorwidth, 设置girdview最左端列宽度【自动生成列,跟绑定的数据列没有关系】。

  2.禁用每个列排序,      this.gridview1.optionscustomization.allowsort = false;

 ---------------------------------------------------------------------------------------
 ---------------------------------------------------------------------------------------

treelist:

1.每个列禁用排序,设置每个列的 optionscolumn.allowsort = false,在run designer每个列中都可看到该属性;

dateedit:

1、禁用鼠标滚动。      

dateedit1.spin += new devexpress.xtraeditors.controls.spineventhandler(dateedit1_spin);
     void dateedit1_spin(object sender, devexpress.xtraeditors.controls.spineventargs e)
     {
      e.handled = true;
     }

以上所述是小编给大家介绍的devexpress treelist 常见问题解决方法,希望对大家有所帮助

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网