none
winform 下 treeview 以及 panel 的闪烁问题 RRS feed

  • 问题

  • 在this.splitContainer.panel1 中放置treeview控件。在this.splitContainer.panel2中放置三个panel控件。想点击treeView控件中不同的节点显示不同的panel. 这三个panel控件的Name分别为panel_jinTianJiaoFangZhuZhe ,panel_chaXun ,panel_tuiFang . 且panel_jinTianJiaoFangZhuZhe .controls.Add(panel_tuiFang );   panel_tuiFang  .controls.Add(panel_chaXun )代码如下:

    private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
            {
                if (e.Node.Text == "今天该交房租的人".Trim())
                {
                                    
                    this.splitContainer1.Panel2.Controls.Clear();
                    this.panel_jinTianJiaoFangZhuZhe.Controls.Remove(this.panel_tuiFang);
                   
                    this.splitContainer2.Panel2.Controls.Add(this.panel_jinTianJiaoFangZhuZhe );
                   

                }
                 else if (e.Node.Text == "空房间查询".Trim())
                {
                     this.splitContainer1.Panel2.Controls.Clear();
                                   
                    this.splitContainer2.Panel2.Controls.Add(this.panel_chaXun );
                }
                else if (e.Node.Text == "退房".Trim())
                {
                     this.splitContainer1.Panel2.Controls.Clear();
                    this.panel_tuiFang.Controls.Remove(this.panel_chaXun);
                    this.splitContainer2.Panel2.Controls.Add(this.panel_tuiFang );
                 }
          }

    功能是实现了,但美中不足的是有闪烁。

    还请各位帮我看看怎么解决闪烁的问题。谢谢!

     


    心悟成佛,心迷成魔.
    2010年8月7日 0:29

答案

全部回复