C++开发博客CSDN

两个checkbox的控件控制操作只能选其一

 CheckedChanged,与CheckStateChanged事件,都是在代码中更改属性都会触发的,因为都是

.CheckedChanged += new System.EventHandler();

.CheckStateChanged += new System.EventHandler();    

   

        private void CodeToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
        {
            if (CodeToolStripMenuItem.CheckState == CheckState.Checked)
            {
                NameToolStripMenuItem.Checked = false;
                CodeToolStripMenuItem.Enabled = false;
                NameToolStripMenuItem.Enabled = true;
                      //执行相关数据操作

           }

        }

        private void NameToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
        {
            if (NameToolStripMenuItem.CheckState == CheckState.Checked)
            {
                CodeToolStripMenuItem.Checked = false;
                NameToolStripMenuItem.Enabled = false;           
                CodeToolStripMenuItem.Enabled = true;
               //执行相关数据操作

            }
        }

 

posted @ 2011-03-23 14:29  纳凉亭子  阅读(626)  评论(0编辑  收藏  举报