如何在MFC中禁用Combobox幻灯片动画效果?
有什么方法可以禁用 MFC 中特定组合框的幻灯片动画效果吗?
通常组合框在打开时会向下滑动,但如果它不适合屏幕,则会向上滑动。我们可以覆盖这个默认行为并让组合框每次都向上滑动吗?
Is there any way I can disable slide animation effect of a particular combo-box in MFC?
Generally combo-box slides downwards while opening, but if it doesn't fit into screen then it slides upwards. Can we override this default behavior and make combo-box slide upwards everytime?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,组合框控件被认为具有下拉样式。您似乎想要一致的“下拉”行为。我最初的想法是将 DrawMode 更改为 Owner-Draw,但这只能让您控制每个项目的视觉方面;您实际上希望选择矩形始终出现在下拉箭头上方。但是,更改 Dock 属性可能会解决问题。我建议使用 DockStyle 为“Bottom”调用 set_Dock(): myDropUpComboBox.set_Dock(DockStyle.Bottom);
另一种选择是基于基本控件类创建您自己的类似组合框的类。这将涉及大量代码来模仿基本组合框提供的大部分标准行为。
Normally, a combobox control is considered to have a drop-down style. You appear to want consistent "drop-up" behavior instead. My initial thought was to change the DrawMode to Owner-Draw but this only gives you control over the visual aspect of each item; you actually want the selection rectangle to always appear above the drop-down arrow. However, changing the Dock property may do the trick. I suggest calling set_Dock() with a DockStyle of "Bottom": myDropUpComboBox.set_Dock(DockStyle.Bottom);
Another option is to create your own combobox-like class based upon the base control class. This would involve considerable code to mimic most of the standard behavior provided by a basic combobox.