问题:
希望的TreeView控件的空白区域添加一个GroupBox,并且GroupBox的背景颜色是透明的
实现方法:
关键点:在VS2008的IDE中,GroupBox缺省是放置在Form上的,要修改为在TreeView之上,GroupBox的位置也要相对调整。
Form1.Designer.CS
修改前Form1内放置GroupBox
this.Controls.Add(this.treeView1);
this.Controls.Add(this.groupBox1);
修改后TreeView内放置GroupBox
this.treeView1.Controls.Add(this.groupBox2);
……
this.Controls.Add(this.treeView1);
//this.Controls.Add(this.groupBox1);
然后设置GroupBox的Location和BackColor属性