Click here to Skip to main content
14,767,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create a Control which inherits Menu strip. I do not need the controls like ComboBox, TextBox Menu Item, I actually need ToolStripRadioButton, ToolStripButton and ToolStripLabel controls. How do I Change the available controls to my required controls.
Can any body suggest any thing.

What I have tried:

I nave created a Class which inherits Menu strip.

Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Windows.Forms

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", GetType(IDesigner))> _
Partial Class MPanel
    Inherits System.Windows.Forms.MenuStrip
    Implements IContainerControl

Dim MItem As New NRadioButton.TSRadio

    <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
    <Editor("System.ComponentModel.Design.CollectionEditor, Systen.Design", GetType(System.Drawing.Design.UITypeEditor))> _
    <Browsable(True)> _
    Public Property MenuItems() As ToolStripItemCollection                           'ToolStripItemCollection
        Get
            'Return mnuMain.Items
            Return Me.Items
        End Get
        Set(ByVal value As ToolStripItemCollection)
            'mnuMain.Items.Clear()
            Me.Items.Clear()

            'For Each elem In value
            'Me.Items.Add(CType(elem, ToolStripItem))
            Me.Items.Add(CType(MItem, ToolStripItem))
            'Next
        End Set
    End Property
Posted
Comments
Gerry Schmitz 30-Dec-20 16:06pm
   
Create your own menu; don't inherit.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900