关于自绘

WM_DRAWITEM 在WTL中对应COwnerDraw,属普通Message
    The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.

也就是说WM_DRAWITEM这套消息支持如下控件:
button, combo box, list box, or menu

NM_CUSTOMDRAW 在WTL中对应CCustomDraw,属ON_NOTIFY消息

href="../../../css/ie4.css" type="text/css" rel="stylesheet" /> href="../../../css/inetsdk.css" type="text/css" rel="stylesheet" /> href="ms-help://Hx/HxRuntime/HxLink.css" type="text/css" rel="stylesheet" /> lpNMCustomDraw
Pointer to a custom draw-related structure that contains information about the drawing operation. The following list specifies the controls and their associated structures.
List view
NMLVCUSTOMDRAW
ToolTip
NMTTCUSTOMDRAW
Tree view
NMTVCUSTOMDRAW
Toolbar
NMTBCUSTOMDRAW
All other supported controls
NMCUSTOMDRAW

Currently, the following controls support custom draw functionality: header, list view, rebar, toolbar, ToolTip, trackbar, and tree view. Custom draw is also supported for button controls if you are running Windows XP and have an application manifest to ensure that Comctl32.dll version 6 is available.

而NM_CUSTOMDRAW消息支持几个扩展控件。

自绘CHeaderCtrl
    CHeaderCtrl也会发NM_CUSTOMDRAW 消息,CHeaderCtrl控件本身的高度是可以通过设置字体或ImageList来调整的,但整合进CListView中的HeaderCtrl就不行了,要改变此HeaderCtrl的高度,需要响应HDM_LAYOUT消息,在此消息中设置。如:
LRESULT OnLayOut(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
    {
        LPHDLAYOUT pLayout = (LPHDLAYOUT)lParam;
        pLayout->pwpos->hwnd            = m_hWnd;
        pLayout->pwpos->hwndInsertAfter = NULL;
        pLayout->pwpos->flags            = SWP_FRAMECHANGED;

        pLayout->pwpos->x                = pLayout->prc->left;
        pLayout->pwpos->y                = 0;
        pLayout->pwpos->cx                = pLayout->prc->right - pLayout->prc->left;
        pLayout->pwpos->cy                = m_nHeight;
        pLayout->prc->top                = m_nHeight;
        return 1L;
    };


href="../../../css/ie4.css" type="text/css" rel="stylesheet" /> href="../../../css/inetsdk.css" type="text/css" rel="stylesheet" /> href="ms-help://Hx/HxRuntime/HxLink.css" type="text/css" rel="stylesheet" />

 


href="../../../../css/ie4.css" type="text/css" rel="stylesheet" /> href="../../../../css/inetsdk.css" type="text/css" rel="stylesheet" /> href="ms-help://Hx/HxRuntime/HxLink.css" type="text/css" rel="stylesheet" />

 

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值