WM_MEASUREITEM Notification-------------------------------------------------------------------------------- The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.A window receives this message through its WindowProc function. Syntax WM_MEASUREITEM WPARAM wParam lpMeasureItem = (LPMEASUREITEMSTRUCT) lParam;
ParameterswParam Contains the value of the CtlID member of the MEASUREITEMSTRUCT structure pointed to by the lpMeasureItem parameter. This value identifies the control that sent the WM_MEASUREITEM message. If the value is zero, the message was sent by a menu. If the value is nonzero, the message was sent by a combo box or by a list box. If the value is nonzero, and the value of the itemID member of the MEASUREITEMSTRUCT pointed to by lpMeasureItem is (UINT) –1, the message was sent by a combo edit field. lpMeasureItem Pointer to a MEASUREITEMSTRUCT structure that contains the dimensions of the owner-drawn control or menu item. Return ValueIf an application processes this message, it should return TRUE. ResWhen the owner window receives the WM_MEASUREITEM message, the owner fills in the MEASUREITEMSTRUCT structure pointed to by the lpMeasureItem parameter of the message and returns; this informs the system of the dimensions of the control. If a list box or combo box is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style, this message is sent to the owner for each item in the control; otherwise, this message is sent once. The system sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending the WM_INITDIALOG message. As a result, when the owner receives this message, the system has not yet determined the height and width of the font used in the control; function calls and calculations requiring these values should occur in the main function of the application or library.
http://www.host01.com/article/software/cc/2006091723323058.htm
试试这个函数
The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.A window receives this message through its WindowProc function.
Syntax
WM_MEASUREITEM WPARAM wParam
lpMeasureItem = (LPMEASUREITEMSTRUCT) lParam;
ParameterswParam
Contains the value of the CtlID member of the MEASUREITEMSTRUCT structure pointed to by the lpMeasureItem parameter. This value identifies the control that sent the WM_MEASUREITEM message. If the value is zero, the message was sent by a menu. If the value is nonzero, the message was sent by a combo box or by a list box. If the value is nonzero, and the value of the itemID member of the MEASUREITEMSTRUCT pointed to by lpMeasureItem is (UINT) –1, the message was sent by a combo edit field.
lpMeasureItem
Pointer to a MEASUREITEMSTRUCT structure that contains the dimensions of the owner-drawn control or menu item.
Return ValueIf an application processes this message, it should return TRUE. ResWhen the owner window receives the WM_MEASUREITEM message, the owner fills in the MEASUREITEMSTRUCT structure pointed to by the lpMeasureItem parameter of the message and returns; this informs the system of the dimensions of the control. If a list box or combo box is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style, this message is sent to the owner for each item in the control; otherwise, this message is sent once. The system sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending the WM_INITDIALOG message. As a result, when the owner receives this message, the system has not yet determined the height and width of the font used in the control; function calls and calculations requiring these values should occur in the main function of the application or library.