开发一个winform程序,想让用户通过选择单选框改变TabControll的标签,同时屏蔽用户鼠标单击,或者用键盘Tab+方向键对TabControll的控制,该怎么写?

解决方案 »

  1.   

    呃,忘了补充一点,我在TabControll的MouseDown事件中判断了单选框的状态,并强制tab不随鼠标单击而改变,这样虽然能保证tab被锁定在想要的位置,但界面上却会有闪烁,不知道有没有其他更好的办法解决这个问题?
            private void tabBackupType_MouseDown(object sender, MouseEventArgs e)
            {
                if (radioButton1.Checked)
                    this.tabBackupType.SelectedIndex = 0;
                else
                    this.tabBackupType.SelectedIndex = 1;
            }
      

  2.   

            void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)
        {
                if (radioButton1.Checked)
                    e.Cancel = true;
        }你的代码是将用鼠标点击切换过去的TAB再切过来,现在改用Selecting事件,当radioButton1选中的时候TAB就会保持不变了,所有的切换TAB事件全部都取法了.
      

  3.   

    combox1.selectindex_Changed(object sender,eventargs e)
    {
    tabcontrols1.selectindex=int.parse(combox1.selectvalue)
    }
      

  4.   


    这样是可以不闪了,但是我现在是两个单选框加以控制,选中radioButton1时显示Tab1,选中radioButton2时显示Tab2,请问这该怎么写啊?
      

  5.   

            void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)
        {
            if (radioButton1.Checked)
            {           if ((e.TabPageIndex)!=0)
                    e.Cancel = true;
            }
            if (radioButton2.Checked)
            {
                if ((e.TabPageIndex) != 1)
                    e.Cancel = true;
            }
           
        }