您的位置:程序门 -> vb -> 基础类



学vb67年,却不知道如何在菜单里加图标,烦死我了,救命啊!!!!!!!!!!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


学vb67年,却不知道如何在菜单里加图标,烦死我了,救命啊!!!!!!!!!![无满意答案结贴,结贴人:yakeebzyc]
发表于:2007-05-23 16:50:39 楼主
学vb67年,却不知道如何在菜单里加图标,烦死我了,救命啊!!!!!!!!!!
发表于:2007-05-23 16:54:341楼 得分:0
在菜单上增加图标  
声明:
declare   function   getmenu   lib   "user32 "   (byval   hwnd   as   long)   as   long
declare   function   getsubmenu   lib   "user32 "   (byval   hmenu   as   long,   byval   npos   as   long)   as   long  
declare   function   getmenuitemid   lib   "user32 "   (byval   hmenu   as   long,   byval   npos   as   long)   as   long  
declare   function   setmenuitembitmaps   lib   "user32 "   (byval   hmenu   as   long,   byval   nposition   as   long,   byval   wflags   as   long,   byval   hbitmapunchecked   as   long,   byval   hbitmapchecked   as   long)   as   long
public   const   mf_bitmap   =   &h4&  
type   menuiteminfo  
cbsize   as   long  
fmask   as   long  
ftype   as   long  
fstate   as   long  
wid   as   long  
hsubmenu   as   long  
hbmpchecked   as   long  
hbmpunchecked   as   long  
dwitemdata   as   long  
dwtypedata   as   string  
cch   as   long  
end   type  
declare   function   getmenuitemcount   lib   "user32 "   (byval   hmenu   as   long)   as   long  
declare   function   getmenuiteminfo   lib   "user32 "   alias   "getmenuiteminfoa "   (byval   hmenu   as   long,   byval   un   as   long,   byval   b   as   boolean,   lpmenuiteminfo   as   menuiteminfo)   as   boolean  
public   const   miim_id   =   &h2  
public   const   miim_type   =   &h10  
public   const   mft_string   =   &h0&


使用:   在   form1   中增加一个   picturebox1,   autosize   为   true,   放一个小   bmp   (不是   icon!推荐   13*13)。
private   sub   command1_click()

'get   the   menuhandle   of   your   app
hmenu&   =   getmenu(form1.hwnd)

'get   the   handle   of   the   first   submenu   (hello)
hsubmenu&   =   getsubmenu(hmenu&,   0)

'get   the   menuid   of   the   first   entry   (bitmap)
hid&   =   getmenuitemid(hsubmenu&,   0)

'add   the   bitmap
setmenuitembitmaps   hmenu&,   hid&,   mf_bitmap,   picture1.picture,   picture1.picture
'you   can   add   two   bitmaps   to   a   menuentry
'one   for   the   checked   and   one   for   the   unchecked
'state.

end   sub  
其实我也不会:)
发表于:2007-05-23 16:54:542楼 得分:0
学vb67年??

靠,学了67年了啊,楼主贵庚啊
发表于:2007-05-23 17:12:503楼 得分:0
lz是不是一直都在学,而在工作中没有用过
发表于:2007-05-23 17:31:384楼 得分:0
顶,楼主有些吹水成分吧,呵呵,偶也不会
发表于:2007-05-23 17:36:405楼 得分:0
这有什么奇怪的不学再过10年还是不会
发表于:2007-05-23 17:56:086楼 得分:0
我从九九年开始学vb,边学边用,尤其是vba,非常好用.
但我没有开发过项目,只是自己写一些工具软件在华军发布.

谢谢各位的帮忙,尤其是   vbtoy(无证编程)   的代码,回家细看
发表于:2007-05-23 18:00:327楼 得分:0
lz说学了6到7年,有什么错,真是的
发表于:2007-05-24 08:02:018楼 得分:0
呵呵,可以用第三方控件
发表于:2007-05-24 08:28:169楼 得分:0
呵呵。楼主是用vb6,用了7年,呵呵。只要以前没用到,现在就不会,肯定的了。要不怎么叫活到老,学到老吗?支持楼主
发表于:2007-05-24 08:32:2310楼 得分:0
qq:398175615联系我一下吧,我给你发个实例
发表于:2007-05-24 17:34:3711楼 得分:0
呵呵
发表于:2007-05-28 10:05:3212楼 得分:0
我已经按一楼的朋友,用api做到了,谢谢!
虽然不是很美观,但其它可以做到美观的代码近3千行.我还是用少点行数的.
发表于:2007-05-28 13:54:0013楼 得分:0
我也你的实例,qq:87548035
发表于:2007-05-28 16:49:5514楼 得分:0
图片菜单源码:

http://www.egooglet.com/static_html/200511072105048597admin.html


快速检索

最新资讯
热门点击