怎样使菜单显示在窗体的两边????????????

StarLee 2002-02-25 04:46:05
怎样使菜蛋显示在窗体的两边,即使菜单一部分显示在窗体的左边,而另一部分显示在窗体的右边,且中间为空白????如:
——————————————————————————————
|文件 选项 帮助|
| |
| |
| |
| |
——————————————————————————————
...全文
84 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shawls 2002-02-25
  • 打赏
  • 举报
回复


给分!!!


效果见:


http://shawls.yeah.net
的源代码数据库软件!
uguess 2002-02-25
  • 打赏
  • 举报
回复
这 一 效 果 是 Windows 3.0的 效 果 , 现 在 已 经 有 些 落 伍 。
在 VB3中 可 以 在 Form_Load中 使 用
menuname.caption=chr$(8)+menuname.caption
将 菜 单 放 在 右 侧 。 不 过 在 VB5以 上 版 本 都 不 行 了 。 在 VB5中 必 须 借 助 于 API才 能 实 现 。 假 定 你 的 菜 单 有 两 项 : File、 Help。 采 用 下 面 的 代 码 可 以 让 Help排 在 最 右 边 。
Const MF_HELP = &H4000&
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
Const MF_BYPOSITION = &H400&
Const MF_POPUP = &H10&
Private Sub Form_Load()
Dim hMenu
hMenu = GetMenu(hwnd)
ModifyMenu hMenu, 1, MF_HELP Or _
MF_POPUP Or MF_BYPOSITION, 0, "Help"
End Sub
shawls 2002-02-25
  • 打赏
  • 举报
回复
'菜单往右
Private Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal Bool As Boolean, lpcMenuItemInfo As MENUITEMINFO) As Long
Private Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal b As Long, lpMenuItemInfo As MENUITEMINFO) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long

Private 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



Dim Menu_Info As MENUITEMINFO
Menu_Info.cbSize = Len(Menu_Info) '44
Menu_Info.fMask = 16
Menu_Info.cch = 128
Menu_Info.dwTypeData = VBA.String$(128, VBA.Chr$(0))
GetMenuItemInfo GetMenu(MainForm.hwnd), 4, True, Menu_Info
'MsgBox Menu_Info.fType
Menu_Info.fType = 16384
SetMenuItemInfo GetMenu(MainForm.hwnd), 4, True, Menu_Info
DrawMenuBar GetMenu(MainForm.hwnd)
shawls 2002-02-25
  • 打赏
  • 举报
回复

我知道!

7,763

社区成员

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

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