无法使tooltripmenuitem可见/可用 [英] Unable to make toolstripmenuitem visible/available

查看:65
本文介绍了无法使tooltripmenuitem可见/可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计。

我在使ToolStripMenuItem对象可见时遇到了一些困难。基本上,我有一个在MDI父表单上的MenuStrip。在File DropDownList上有另一个名为Close Views ...的DDL。在那个DDL上我有五个通用的tsmItem,它们的Visible属性设置为False。这是主要代码:

Hey Guys.
I'm having some difficulty getting my ToolStripMenuItem objects visible. Basically, I have a MenuStrip which is on an MDI parent form. On the File DropDownList there is another DDL called "Close Views...". On that DDL I have five generic tsmItems which have their Visible property set to False. Here's the primary code:

Dim menuItem As ToolStripMenuItem = Nothing
Dim itemList As ToolStripItemCollection = Me.tsmCloseViews.DropDownItems()
For Each tsmObj As Object In itemList
    menuItem = TryCast(tsmObj, ToolStripMenuItem)
    If menuItem.Tag = "(Open)" Then
        With menuItem
            .Tag = NewForm.Name
            .Text = "Close " & FormText
            .GetCurrentParent.Visible = True
            .Visible = True
            .Available = True
        End With
        Exit For
    End If
Next





我怀疑tsmItems上的修饰符需要设置为Protected或其他一些我忽略的小设置。



任何输入都将不胜感激!



我尝试过:



如上面的代码所示,我尝试了几种在互联网上各种帖子中描述的方法。



I suspect that the modifiers on the tsmItems need to be set to Protected or some other little setting that I am overlooking.

Any input would be appreciated!

What I have tried:

As shown in the above code, I have tried several methods which are described in various posts on the internet.

推荐答案

嗯,我m完全确定原因,但是将代码移出模块并进入包含MenuStrip的Main类解决了问题。



我想我们会考虑这个一个关闭。
Well, I'm not entirely sure why, but moving the code out of the module and into the Main class where the MenuStrip was contained solved the problem.

I guess we'll consider this one closed.


这篇关于无法使tooltripmenuitem可见/可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆