Visual Studio 2008,下拉菜单项不起作用
我正在把头撞在墙上试图弄清楚这一点。我的 GUI 上有一个水平菜单,并将 helpMenuItem 设置为不可见几分钟。我再次将其设置为可见,现在,当我将鼠标悬停/单击 helpMenuItem 时,它不会显示下拉菜单项。其他菜单项下拉菜单工作正常,这是唯一一个不会显示带有适当的“userManualMenuItem”的下拉菜单。
我尝试过重建、清理、关闭并重新打开视觉工作室,但这些都没有帮助。下面是我的菜单中的“帮助”按钮的示例,以及不会显示的下拉菜单项“用户手册”。此外,视觉工作室还为相关项目生成了代码。
感谢您的任何帮助。
文件 |编辑|帮助
................|用户手册 |
//
// helpMenuItem
//
this.helpMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.userManualMenuItem});
this.helpMenuItem.Name = "helpMenuItem";
this.helpMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpMenuItem.Text = "Help";
//
// userManualMenuItem
//
this.userManualMenuItem.Name = "userManualMenuItem";
this.userManualMenuItem.Size = new System.Drawing.Size(152, 22);
this.userManualMenuItem.Text = "User Manual";
this.userManualMenuItem.Click += new System.EventHandler(this.userManualMenuItem_Click);
//
// menu
//
this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMenuItem,
this.setupMenuItem,
this.subcontractorsMenuItem,
this.reportsMenuItem,
this.windowMenuItem,
this.helpMenuItem});
this.menu.Location = new System.Drawing.Point(0, 0);
this.menu.Name = "menu";
this.menu.Size = new System.Drawing.Size(714, 24);
this.menu.TabIndex = 4;
this.menu.Text = "menu";
编辑:我在 helpMenuItem 中创建了另一个菜单项,它在我运行程序时出现。然而,另一个“userManualMenuItem”仍然没有出现。然后我从 GUI 中删除了旧的 userManualMenuItem,并将新的 userManualMenuItem 重命名为相同的“userManualMenuItem”,再次打开程序后,它没有显示。看来菜单项本身有问题,而不是帮助下拉菜单项有问题......
I'm beating my head against the wall trying to figure this out. I have a horizontal menu on my GUI, and set the helpMenuItem to be invisible for a few minutes. I set it to visible again, and now, when I hover/click on the helpMenuItem, it doesn't display the drop down menu items. The other menu items drop downs work fine, this is the only one that won't display a drop down with the appropriate "userManualMenuItem" inside.
I've tried rebuilding, cleaning, and closing and reopening visual studio, those haven't helped. Below is an example of the Help button in my menu, and the drop down menu item "User Manual", that won't show. Also, the visual studio generated code for the items in question.
Thanks for any help.
File | Edit | Help
................| User Manual |
//
// helpMenuItem
//
this.helpMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.userManualMenuItem});
this.helpMenuItem.Name = "helpMenuItem";
this.helpMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpMenuItem.Text = "Help";
//
// userManualMenuItem
//
this.userManualMenuItem.Name = "userManualMenuItem";
this.userManualMenuItem.Size = new System.Drawing.Size(152, 22);
this.userManualMenuItem.Text = "User Manual";
this.userManualMenuItem.Click += new System.EventHandler(this.userManualMenuItem_Click);
//
// menu
//
this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMenuItem,
this.setupMenuItem,
this.subcontractorsMenuItem,
this.reportsMenuItem,
this.windowMenuItem,
this.helpMenuItem});
this.menu.Location = new System.Drawing.Point(0, 0);
this.menu.Name = "menu";
this.menu.Size = new System.Drawing.Size(714, 24);
this.menu.TabIndex = 4;
this.menu.Text = "menu";
EDIT: I made another menu item in the helpMenuItem, and it appeared when I ran the program. The other "userManualMenuItem" was still not showing up, however. I then deleted the old userManualMenuItem from the GUI, and renamed the new one to the same "userManualMenuItem", and after opening the program again, it did not show up. It seems that there is a problem with the menu item itself, and not the help drop down menu item...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上面的代码片段没有什么奇怪的,我建议您在 userManualMenuItem 上为 VisibleChanged 事件添加一个事件监听器,然后设置一个断点,一旦到达,尝试遍历调用堆栈以找到导致菜单出现的代码行消失。
Nothing is strange in the above snippet, I suggest that you add an event listner for the VisibleChanged Event on your userManualMenuItem and then set a break point, once reached, try to walk through the call stack to find the line of code causing the menu to disappear.