选择供应商
供应商分类使用XtraTreeList
设定两个参数,产生树。显示的是Information
this.vendorType_treeList.KeyFieldName = "Information";
this.vendorType_treeList.ParentFieldName = "Type";
表格式为2列Type,Information
加宽了行距
this.vendorType_treeList.CustomizationRowCount = 30;
取消了横线,竖线,行头
this.vendorType_treeList.OptionsView.ShowHorzLines = false;
this.vendorType_treeList.OptionsView.ShowIndicator = false;
this.vendorType_treeList.OptionsView.ShowVertLines = false;
设定节点图标(NodeImage)
先设定imagelist
this.vendorType_treeList.SelectImageList = this.imageCollection16;
这样显示的均是第一个图标(selectImageIndex=0)
试了半天,不知对否,
事件
private void vendorType_treeList_CustomDrawNodeImages(object sender, CustomDrawNodeImagesEventArgs e)
{
//e.SelectImageIndex = e.Node.Level+1;
if( Convert.ToString(e.Node.GetValue("Information")).Trim ()=="驻扎地区") e.SelectImageIndex =1;
if(Convert.ToString(e.Node.GetValue("Information")).Trim() == "产品类型") e.SelectImageIndex =3;
if (Convert.ToString(e.Node.GetValue("Type")).Trim() == "产品类型") e.SelectImageIndex = 4;
if (Convert.ToString(e.Node.GetValue("Type")).Trim() == "驻扎地区") e.SelectImageIndex = 2;
}
e.node.level是节点层级,如果图标不与内容相关,这个就可以
错误或不完善性很高