protected void Draw(List <项列表的状态> e) {//将选项列表的属性赋值,并绘制选项列表. 项列表 Tmp; for (int i = 0; i < e.Count; i++) { Tmp = new 项列表(e[i].title, e[i].state); Tmp.Size = new Size(this.Size.Width - 20, 项列表默认高度); //生成的 选项列表 宽度为 选项列表框的宽度-20(右侧滑动条宽度) 这样不会出现底侧的滑动条 Tmp.Location = new Point(0, i * 项列表默认高度); //生成的 选项列表 在 选项列表框 的左上角,x=0 y=i*50 Tmp.OpenOrClose += new EventHandler(e[i].OpenOrClose); Tmp.RegKey = e[i].RegKey; this.Controls.Add(Tmp); } }
private void Process(object sender, EventArgs e)//点击启用或者禁用的处理函数 { 项列表 tmp = ( 项列表)sender; if (tmp.State) { if (RegEdit.MyDeleteSubKeyTree(tmp.RegKey)) //删除此tmp的注册表路径 { tmp.State = !tmp.State; } else { MessageBox.Show("删除失败!", "Warning:", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }