日期:2014-05-19  浏览次数:20810 次

TreeView的ICO显示,Text值正确,但是没显示出来
private   void   SecurityManage_Load(object   sender,   EventArgs   e)
                {
                        ImageList   il   =   new   ImageList();
                        il.Images.Add( "1 ",   Properties.Resource.ICODepart);
                        treeView1.ImageList   =   il;
                        treeView1.ImageKey   =   "1 ";

                        Organization   ot=new   Organization();
                        ot.GetOrganizationTree(treeView1.Nodes, "top ");
                        treeView1.Nodes[0].Expand();
                }
不加前四句正常,加了就有问题了。

------解决方案--------------------
在 "设计 "中改一下属性
------解决方案--------------------
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DGM));
ImageList imgList2 = new ImageList();
imgList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject( "imgList.ImageStream ")));
imgList2.TransparentColor = System.Drawing.Color.Transparent;

imgList2.Images.SetKeyName(0, "BOOK01A.ICO ");

tvShow.ImageList = imgList2;
tvShow.ImageKey = "0 ";


因为 你的 前 4 句 有问题 ////////////////////