界面开发之Flat3DButton[4]

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

本文简介:选择自 40star 的 blog

                            byval wparam as long, byval lparam as long) _
                            as long
   dim di as drawitemstruct
   if msg = wm_destroy then terminate (hwnd)
   '处理自画消息
   if msg = wm_drawitem then
      copymemory di, byval lparam, len(di)
      '判断是自画button
      if di.ctltype = odt_button then
        
         drawbutton di.hwnditem, di.hdc, di.rcitem, di.itemstate
         '不返回vb的默认button绘制过程
         subwndproc = 1
         exit function
      end if
     
   end if
   subwndproc = callwindowproc(prevwndproc, hwnd, msg, wparam, lparam)
end function

public sub init(hwnd as long)
  prevwndproc = setwindowlong(hwnd, gwl_wndproc, addressof subwndproc)
end sub

public sub terminate(hwnd as long)
  call setwindowlong(hwnd, gwl_wndproc, prevwndproc)
end sub
' -- 模块结束 -- '

3. form1中的代码

option explicit

private sub form_load()
call init(me.hwnd)
end sub

private sub form_unload(cancel as integer)
call terminate(me.hwnd)

本文关键:Button WM_DRAWITEM SubClass 界面
  相关方案
Google
 

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

go top