比如像qq这样添加好友分组:用树状列表做。
这个是列表:
然后添加的时候就像这样:
每次在小框里面添加分组的时候 那个树状列表就能马上显示出来,,,每次做这样的都必须要刷新一次才能显示,怎么才能马上显示出来呢?

解决方案 »

  1.   

    public partial class Form1 : Form
        {
     
     
            public Form1()
            {
                InitializeComponent();
            }
     
            public void RefreshListBox()
            {
                listBox1.Items.Clear();
                //Read xml add items to listbox
                MessageBox.Show("Refreshed");
     
            }
     
            private void button1_Click(object sender, EventArgs e)
            {
                Form2 frmTarget = new Form2();
                frmTarget.Show(this);//<---note the 'this'
            }
        } public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
            }
     
     
     
            private void Form2_Load(object sender, EventArgs e)
            {
     
            }
     
            private void Form2_FormClosing(object sender, FormClosingEventArgs e)
            {
                ((Form1)this.Owner).RefreshListBox();
            }
        }