选中的列表框
当选中列表框中的所有项目均未选中时,我想执行一些操作。只有 ItemCheck 事件,但检查状态直到 ItemCheck 事件发生后才会更新。 我有一个按钮,当选中列表框中的所有项目均未选中时,我想将其启用为 false
System::Void frmMain::clbInstPrgs_ItemCheck(System::Object^ sender, System::Windows::Forms::ItemCheckEventArgs^ e) {
if ((clbInstPrgs->CheckedIndices->Count == 1)&&(rbnSelectSaveProgramms->Enabled)) {
btnNext->Enabled = false;
} else {
btnNext->Enabled = true;
}
return;
}
i want to do some actions when all items in checked list box are unchecked. There is only event ItemCheck but the check state is not updated until after the ItemCheck event occurs.
I have a button and i want to do its enabled false when all items unchecked in checked list box
System::Void frmMain::clbInstPrgs_ItemCheck(System::Object^ sender, System::Windows::Forms::ItemCheckEventArgs^ e) {
if ((clbInstPrgs->CheckedIndices->Count == 1)&&(rbnSelectSaveProgramms->Enabled)) {
btnNext->Enabled = false;
} else {
btnNext->Enabled = true;
}
return;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只选中了一项,并且由于取消选中某项而处于事件处理程序中,则最终将不会检查任何内容。
这是VB中的答案。应该很容易转换。
If you only have one item checked, and you are in the event handler because you are unchecking something, you will end up with nothing checked.
Here is a answer in VB. Should convert easily.