以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]动态增加窗口主菜单和工具栏 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=192766) |
-- 作者: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) |
-- 作者:有点蓝 -- 发布时间:2024/7/20 11:17:00 -- 注意标题和控件名称的区别 改为 Case "File"
|