// 以下两个消息都是父窗口收到的
1. WM_MEASUREITEM // 拦截这个消息, 设置相应的属性
// The MEASUREITEMSTRUCT structure informs the system of the dimensions of an owner-drawn control or menu item.
// This allows the system to process user interaction with the control correctly.
typedef struct MEASUREITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemWidth;
UINT itemHeight;
ULONG_PTR itemData;
} MEASUREITEMSTRUCT;
2. WM_DRAWITEM
typedef struct tagDRAWITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemAction;
UINT itemState;
HWND hwndItem; // 整个控件
HDC hDC; // 整个可见视图
RECT rcItem; // 相对于整个控件
ULONG_PTR itemData;
} DRAWITEMSTRUCT;
注意:
WM_DRAWITEM 和 NM_CUSTOMDRAW 的区别,
1. WM_DRAWITEM 只有当创建窗口时设置了自绘风格时才会响应.
例如list view 设置了 LVS_OWNERDRAWFIXED 风格
2. 在WM_DRAWITEM中所有都需要由客户来重绘
3. 如果没有设定所有绘制, 是不会收到WM_MEASUREITEM消息的
http://hi.baidu.com/zhugang0911/blog/item/cf7e542442a7ef2e8644f967.html

被折叠的 条评论
为什么被折叠?



