如何隐藏或删除用户控件的现有智能标记?

时间:2017-03-31 22:20:33

标签: c# .net vb.net visual-studio windows-forms-designer

SCENARIO

我有这个继承自ComboBox的控件,它会显示此智能标记“编辑项目...... ”:

enter image description here

我想要做的是从我的控件中删除该命令,以避免用户编辑该控件的Items集合。

到目前为止,我只是隐藏了源代码中的Items属性:

C#版本:

public class DriveComboBox : ImageComboBox { // ImageComboBox inherits from ComboBox

    [Browsable(false)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    [MergableProperty(false)]
    [Bindable(false)]
    public new ImageComboBoxItemCollection Items {
        get { return base.Items; }
    }
}

VB.NET版本:

Public Class DriveComboBox : Inherits ImageComboBox ' ImageComboBox inherits from ComboBox

    <Browsable(False)>
    <EditorBrowsable(EditorBrowsableState.Never)>
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    <MergableProperty(False)>
    <Bindable(False)>
    Public Shadows ReadOnly Property Items As ImageComboBoxItemCollection
        Get
            Return MyBase.Items
        End Get
    End Property

End Class

...我知道无论如何都可以访问成员名称,但至少它对普通用户是隐藏的。

问题

如何为我的控件隐藏/删除“编辑项目... ”Smart Taf?。

并且如果有人能记住我的MSDN文章的网址,请解释如何向该菜单添加新的命令/任务...

编辑:没必要,@ Plutonix 已经回复了我的可选请愿书。

0 个答案:

没有答案