Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]动态增加窗口主菜单和工具栏

1楼
njzwm 发表于:2024/7/20 10:56:00
请教:
动态增加窗口主菜单和工具栏后,点击命令应该放在哪里?我尝试放在ItemClick事件中,没有反应,应该如何写?
ItemClick:

Select Case e.StripItem.Name
    Case "文件"
        MessageBox.Show("文件演示")
    Case "新建"
        MessageBox.Show("新建演示")
    Case "打印"
        CurrentTable.Print(True, False)
End SelectSelect Case e.StripItem.Name
    Case "文件"
        MessageBox.Show("文件演示")
    Case "新建"
        MessageBox.Show("新建演示")
    Case "打印"
        CurrentTable.Print(True, False)
End Select

AfterLoad:
Dim Strip As WinForm.Strip
Strip = e.Form.Strips.Add("工具栏1", StripTypeEnum.ToolBar)
Strip.Items.Add("New", "新建", "new.ico", StripItemTypeEnum.Button)
Strip.Items.Add("Open", "打开", "Open.ico", StripItemTypeEnum.Button)
Strip.Items.Add("Save", "保存", "Save.ico", StripItemTypeEnum.Button)
Strip.Items.Add("Print", "打印", "Print.ico", StripItemTypeEnum.Button)
Strip.Items.Add("Separator1", "分割条", "", StripItemTypeEnum.Separator)
Strip.Items.Add("Cut", "剪切", "Cut.ico", StripItemTypeEnum.Button)
Strip.Items.Add("Copy", "复制", "Copy.ico", StripItemTypeEnum.Button)
Strip.Items.Add("Brush", "格式刷", "Brush.ico", StripItemTypeEnum.Button)
Strip.Items.Add("Separator2", "分割条", "", StripItemTypeEnum.Separator)
Strip.Items.Add("Help", "帮助", "Help.ico", StripItemTypeEnum.Button)

Dim mnu As Winform.Strip
Dim itm As WinForm.StripItem
mnu = e.Form.Strips.Add("主菜单", StripTypeEnum.MainMenu)
mnu.Items.Add("File", "文件(&F)", "", StripItemTypeEnum.MenuItem)
mnu.Items.Add("Edit", "编辑(&E)", "", StripItemTypeEnum.MenuItem)
mnu.Items.Add("Option", "选项(&O)", "", StripItemTypeEnum.MenuItem)
mnu.Items.Add("Help", "帮助(&H)", "", StripItemTypeEnum.MenuItem)
'在主菜单右侧增加一个按钮
mnu.Items.Add("Home", "主页", "home.ico", StripItemTypeEnum.Button)
mnu.Items("Home").DisplayText = False
mnu.Items("Home").DockToRight = True '靠右停放
'为文件菜单增加项目
itm = mnu.Items("File")
itm.Items.Add("New", "新建", "new.ico", StripItemTypeEnum.MenuItem)
itm.Items.Add("Open", "打开", "Open.ico", StripItemTypeEnum.MenuItem)
itm.Items.Add("Save", "保存", "Save.ico", StripItemTypeEnum.MenuItem)

2楼
有点蓝 发表于:2024/7/20 11:17:00
注意标题和控件名称的区别

Case "文件"
改为
Case "File"
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 2 queries.