65.9K
CodeProject 正在变化。 阅读更多。
Home

具有正确 SelectedIndexChanged 支持的 ComboBox

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.33/5 (6投票s)

2004年11月26日

viewsIcon

34645

downloadIcon

612

修正了标准 ComboBox 中关于 SelectedIndexChanged 事件的 bug。

引言

如果你使用ComboBox,并且希望在ComboBox中选择新的项目时更改其他各种控件,那么SelectedIndexChanged事件应该能帮助你。但是,如果你不通过鼠标点击或上下箭头改变项目,这个事件就不会触发。因此,受到Furty(Divider Panel - A Tutorial on creating a custom Windows Forms control from Start to Toolbox)的启发,我编写了这个替代方案。它简单地在KeyUp事件触发时触发SelectedIndexChanged事件。

我知道这并不是一项伟大的作品,但它或许能帮助到某人。

© . All rights reserved.