CListBox创建控件大小自动变化

来源:互联网 发布:jdbc mysql的url 编辑:程序博客网 时间:2024/05/22 11:40

CListBox手动创建的窗口,添加string后。
如果SetItemHeight大小总是和MoveWindow后的大小不符,总是会变小;如果不调用SetItemHeight则无此问题。巨坑啊。实际上解决此问题的方法非常简单,只要加上如下属性即可:LBS_NOINTEGRALHEIGHT

msdn对LBS_NOINTEGRALHEIGHT的解释如下:
LBS_NOINTEGRALHEIGHT
Specifies that the size of the list box is exactly the size specified by the application when it created the list box. Normally, the system sizes a list box so that the list box does not display partial items.
For list boxes with the LBS_OWNERDRAWVARIABLE style, the LBS_NOINTEGRALHEIGHT style is always enforced.

原创粉丝点击