Height of CComboBox's drop down list

探讨并解决CommonControl6.0和5.0版本中CComboBox组件在未设置CBS_NOINTEGRALHEIGHT属性时,滚动条表现差异的问题,提供了一个自定义函数来调整滚动条高度,确保用户界面一致性。
当Common Control 6.0 和 Common Control 5.0的CComboBox不太一样

当没设置CBS_NOINTEGRALHEIGHT时,5.0会算一个比较合适的滚动条,而6.0几乎会全展开(一直到屏幕边缘显示不下才有滚动条)。

void ResizeComboBoxHeight(CComboBox &combo, int lines) { CRect cbsize; // current size of the combo box int height; // new height combo.GetClientRect(&cbsize); // Compute the new height. height = combo.GetItemHeight(-1); height += combo.GetItemHeight(0)*lines; height += GetSystemMetrics(SM_CYEDGE)*4; // top and botton edges for editbox and dropdown box combo.SetWindowPos(NULL,0,0,cbsize.right,height,SWP_NOMOVE | SWP_NOZORDER); }



转载于:https://www.cnblogs.com/marryZhan/archive/2011/09/13/2213903.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值