rt

解决方案 »

  1.   

    imagelist设置好以后,记得把treeview的treenode的imageindex什么的给设置好应该可以的.
      

  2.   

    public class MyTreeView:TreeView
        {
            private System.ComponentModel.IContainer components;        private void InitializeComponent()
            {
                this.components = new System.ComponentModel.Container();
                System.Windows.Forms.ImageList imageList1;
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(YqunTreeView));
                imageList1 = new System.Windows.Forms.ImageList(this.components);
                this.SuspendLayout();
                // 
                // imageList1
                // 
                imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
                imageList1.TransparentColor = System.Drawing.Color.Transparent;
                imageList1.Images.SetKeyName(0, "color1.ico");
                imageList1.Images.SetKeyName(1, "color2.ico");
                imageList1.Images.SetKeyName(2, "color3.ico");
                // 
                // YqunTreeView
                // 
                this.ImageIndex = 0;
                this.ImageList = imageList1;
                this.LineColor = System.Drawing.Color.Black;
                this.SelectedImageIndex = 0;
                this.ResumeLayout(false);        }
            
        }
    为什么不显示图片
      

  3.   

    你查看以下imagelist是否正确生成