可恶的老外,这么好的控件(ICONMENU)竟然不支持中文,请高手解决!!!!!!!!

OLD_VB_FAN 2001-07-02 06:19:39
网站上发现了一个很小的,能比ACTIVEBAR更快捷地创建带图标菜单的控件--->ICONMENU,IMAGELIST中的每个图标对应一个菜单条的CAPTION(标题),用英文可以顺利地将图标(BMP)加到菜单中,但我试了很多次,该控件就是不支持中文菜单条标题(CAPTION),请高手倾力指点如何解决。

该控件比较容易操作,很简单,远比ACTIVEBAR容易,所以我很想使用它,而且可以用它直接利用工具条的IMAGELIST,一举两得呀。

该控件(含示例源代码)下载处:
http://202.103.176.84/erun/adamyl/vbcontrols/download/im209.zip
...全文
220 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
haitaoyu 2001-07-04
  • 打赏
  • 举报
回复
gz
thriller 2001-07-04
  • 打赏
  • 举报
回复
关键是DrawText和TextOut的控制,中文字符在VB5、6里是按一个字节,但他其实是两个字节,也就是说,Len("我们")=2,但DrawText却认为它是4,所以丢了后面的字符。
thriller 2001-07-04
  • 打赏
  • 举报
回复
这有什么,我用纯VB代码完全做的到。抓屏助手的菜单怎么样?比它好吧?
http://vbaccelerator.com/有这方面的代码下载。
不过我可不是用的他的,我自己写的。
OLD_VB_FAN 2001-07-04
  • 打赏
  • 举报
回复
NEW:

各位,请参观
http://www.csdn.net/expert/topic/181/181778.shtm
http://www.csdn.net/expert/topic/181/181764.shtm
有经验解决者请援手!!!
OLD_VB_FAN 2001-07-04
  • 打赏
  • 举报
回复
各位GO ON!
OLD_VB_FAN 2001-07-04
  • 打赏
  • 举报
回复
本帖暂保留,再加分30,请各位畅谈!!!!!!!!!!!!!
OLD_VB_FAN 2001-07-03
  • 打赏
  • 举报
回复
@_@
OLD_VB_FAN 2001-07-03
  • 打赏
  • 举报
回复
TO joeking(天龙):菜单条的标题(CAPTION)
OLD_VB_FAN 2001-07-03
  • 打赏
  • 举报
回复
Question: how to make the iconmenu control to support chinese menuitem's caption? Date: 07/02/2001 06:40AM PST
From: new_fan
Status: Waiting for Answer Points: 100
Email A Friend
I downloaded the control and its sample codes in the site as below:
http://202.103.176.84/erun/adamyl/vbcontrols/download/im209.zip

use this control, you can add bmp image into the menuitem easily, what you do is just add some bmp images
into a imagelist, then map each bmp image's keyword with a menuitem's caption (same), it works well
when i use some english menuitem'caption, but I found this control cannot support the chinese menuitem's
caption, could you tell me how to solve this problem?
Question History
Comment
From: jrspano Date: 07/02/2001 06:49AM PST
i have a class if you want it that will add icons to the menu items. it uses api calls and is number
based and not string based. I have only tried it with ico files though
Comment
From: new_fan Date: 07/02/2001 07:10AM PST
jrspano,could you give me your class and sample codes?
my email: xy_wu@netease.com
Comment
From: amit_panjwani Date: 07/02/2001 10:03AM PST
watching...
I have code ...
it works this way
I add picture boxes
specify pic source(any imge files I might need ) for pic box
... In your context you can use PRINT with Picturebox and specify font as well(in your case it may be
chinese font installed on your computer).
If you need code , lemme know

Amit


Comment
From: jrspano Date: 07/02/2001 10:20AM PST
i'll post it here so any one can see it.
copy it into a class module. add a image list.
make a new var of the class and then run. set the image list to use property with your image list. call
set menu picture for each item you want to set
ex
in ms stuff file is always first is would be postion 0 each item under it would be a number starting
with 0


SetMenuPicture 0,0,"keyforimagelist"
this would do file new
for file open it would be 0,1,"key" etc.

' ******************************************************************************
' Routine: CMenuWrapper
'
' Purpose: Class to provide menu functions not in VB
' ******************************************************************************

Option Explicit

'APIs used in class
Private Declare Function GetMenu Lib "user32" _
(ByVal hwnd As Long) As Long

Private Declare Function GetSubMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPos As Long) As Long

Private Declare Function GetMenuItemID Lib "user32" _
(ByVal hMenu As Long, ByVal nPos As Long) As Long

Private 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
'''''''''''''''

Private m_ImageListSet As Boolean 'test to see if image list has been set
Private m_FormHwnd As Long
Private m_MenuHwnd As Long
Private m_ImageList As ImageList

Public Sub SetMenuPicture(MenuId As Long, MenuSubId As Long, ImageKey As Variant)
' ******************************************************************************
' Routine: SetMenuPicture
'
' Purpose:This sub actually sets the picture for the menu item
'
' Input Variables:MenuId 0 based item you want to work on menus go left to
' right 0 to whatever
' MenuSubId the item in MenuId you want to work on these
' go top to bottom 0 to whatever with separaters counting
' Key is the immage list position id or Key
' Output Variables:None
' ******************************************************************************
On Error GoTo hErr

Dim lngMenuItemID As Long
Dim lngRet As Long
Dim lngSubMenuHwnd As Long

'make sure vars have been set
If m_FormHwnd = 0 Then
Err.Raise vbObjectError + 1000, "CMenuWrapper", "FormHwnd hasn't been set!"
ElseIf m_ImageListSet = False Then
Err.Raise vbObjectError + 1001, "CMenuWrapper", "ImageList hasn't been set!"
End If

'get the menu hwnd from the form hwnd passed in
m_MenuHwnd = GetMenu(m_FormHwnd)

'get the header menu hwnd that we want to add picture to from menuhwnd and menu item user passes
in
lngSubMenuHwnd = GetSubMenu(m_MenuHwnd, MenuId)

'get the actual hwnd for sub item user wants
lngMenuItemID = GetMenuItemID(lngSubMenuHwnd, MenuSubId)

'set the picture for menu item
lngRet = SetMenuItemBitmaps(m_MenuHwnd, lngMenuItemID, 0, _
m_ImageList.ListImages(ImageKey).Picture, m_ImageList.ListImages(ImageKey).Picture)

Exit Sub

hErr:
Err.Raise Err.Number, "CMenuWrapper", Err.Description
End Sub

Public Property Set ImageListToUse(data As ImageList)
' ******************************************************************************
' Routine: ImageListToUse
'
' Purpose:Sets the image list to use when setting pictures
'
' Input Variables:the image list statments must be in the form
' Set DimedVarAsCMenuWrapper = imagelist1
'
' Output Variables:None
' ******************************************************************************
Set m_ImageList = data
m_ImageListSet = True
End Property

'simple let and get for form hwnd setting/getting
Public Property Let FormHwnd(data As Long)

m_FormHwnd = data

End Property

Public Property Get FormHwnd() As Long

FormHwnd = m_FormHwnd

End Property

Private Sub Class_Initialize()

m_ImageListSet = False

End Sub

joeking 2001-07-03
  • 打赏
  • 举报
回复
笨方法:如果把CAPTION直接写到图片里呢?用一个图象编辑软件可以做到,对不对?
我没有下,也不想试,我对别人的控件不感兴趣,除非真的有用,呵呵。
kyuwong 2001-07-02
  • 打赏
  • 举报
回复
这个东西我试过了,在我的机器上里面的例程一运行就出错,自己写的亦出错。
可能Win2000用不到,我的环境和大侠一样。
huanggx 2001-07-02
  • 打赏
  • 举报
回复
我下载了你上面公布的那个im209.zip,里面的例程在我的机器上看不见菜单。但把鼠标放到菜单的位置,能看到突起的按钮。一点就会导致vb6出错,被系统杀掉。
我的环境是win2000sp2, 中文vb6 sp5
OLD_VB_FAN 2001-07-02
  • 打赏
  • 举报
回复
@_@
OLD_VB_FAN 2001-07-02
  • 打赏
  • 举报
回复
to iProgram(赶快去掉这鬼东西):不用写代码,直接在IMAGELIST中将菜单条的标题(CAPTION)与每一个图标(BMP)相对应即可,英文标题菜单没问题,中文的则图标无法显示,而其他效果均可以使用。
TO:huanggx(大侠):我下载的好象没有限制呀! 
huanggx 2001-07-02
  • 打赏
  • 举报
回复
已经有破解了吗?
iProgram 2001-07-02
  • 打赏
  • 举报
回复
试试在添加中文的代码的中文后加上chr(0),入:
xx.AddCaption("中文Caption" & chr(0))

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧