重绘listbox时遇到的问题,开始在OnMeasureItem里做的操作,结果挂了。。。在MeasureItem里OK。
CSDN上达人的解释。。。清楚了。
OnMeasureItem will be called only if the control's class is created at run time,
or it is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style.
If the control is created by the dialog editor, OnMeasureItem will not be called.
This is because the WM_MEASUREITEM message is sent early in the creation process of the control.
If you subclass by using DDX_Control, SubclassDlgItem, or SubclassWindow,
the subclassing usually occurs after the creation process.
Therefore, there is no way to handle the WM_MEASUREITEM message in the
control's OnChildNotify function, which is the mechanism MFC uses to implement
ON_WM_MEASUREITEM_REFLECT.
另一个的解释是OnMeasureItem是响应子控件的WM_MEASUREITEM消息的,MeasureItem是响应反射的自己发送的WM_MEASUREITEM消息的。
上面貌似是MSDN上的...
posted on 2008-05-27 23:59
田园的拾荒者 阅读(5290)
评论(1) 编辑 收藏 引用 所属分类:
C/C++