VB打造超酷个性化菜单(六)[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 goodname008 的 blog

vb打造超酷个性化菜单(六)

 

(接上篇)

 

' 拦截菜单消息 (frmmenu 窗口入口函数)
function menuwndproc(byval hwnd as long, byval msg as long, byval wparam as long, byval lparam as long) as long
    select case msg
        case wm_command                                                 ' 单击菜单项
            if myiteminfo(wparam).itemtype = mit_checkbox then
                if myiteminfo(wparam).itemstate = mis_checked then
                    myiteminfo(wparam).itemstate = mis_unchecked
                else
                    myiteminfo(wparam).itemstate = mis_checked
                end if
            end if
            menuitemselected wparam
        case wm_exitmenuloop                                            ' 退出菜单消息循环(保留)
           
        case wm_measureitem                                             ' 处理菜单项高度和宽度
            measureitem hwnd, lparam
        case wm_menuselect                                              ' 选择菜单项
            dim itemid as long
            itemid = getmenuitemid(lparam, wparam and &hff)
            if itemid <> -1 then
                menuitemselecting itemid
            end if
        case wm_drawitem                                                ' 绘制菜单项
            drawitem lparam
    end select
    menuwndproc = callwindowproc(premenuwndproc, hwnd, msg, wparam, lparam)
end function

' 处理菜单高度和宽度
private sub measureitem(byval hwnd as long, byval lparam as long)
    dim textsize as size, hdc as long
    hdc = getdc(hwnd)
    copymemory measureinfo, byval lparam, len(measureinfo)

本文关键:VB XP 个性化 风格 菜单
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top