日期:2014-05-17  浏览次数:20931 次

comboBox1_SelectedIndexChanged事件


如上图:radiobutton_checkedchanged事件与comboBox1_SelectedIndexChanged事件,相结合

C# code
private void radioButton318_CheckedChanged(object sender, EventArgs e)
        {
            if (tmpRadio != null)
            {
                tmpRadio.Checked = false;
            }
            tmpRadio = (sender as RadioButton);

            if (radioButton318.Checked)
            {
               clsGridStyle.rdo318();
               clsCellCompute.rdo318();                
               List.OwnerDrawCell += new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawBrokenline.rdo318);
               List.OwnerDrawCell += new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawImage.rdo318);
            }
            else
            {
                List.OwnerDrawCell -= new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawBrokenline.rdo318);
                List.OwnerDrawCell -= new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawImage.rdo318); 
            }
        }


F5调试的时候,执行上面的代码,进行关于“7”的查询
触发comboBox1_SelectedIndexChanged后
radioButton318 处于unchecked状态,怎么回事呢?



C# code

 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //
        }


comboBox1_SelectedIndexChanged事件里的代码该如何写呢?谢谢

------解决方案--------------------
你这代码根本就不对。

List.OwnerDrawCell -= new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawBrokenline.rdo318);
根本就不能移除你之前添加的事件处理函数。