Results 1 to 5 of 5

Thread: Owner-drawn menus

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    Owner-drawn menus

    I already know how to make an owner-drawn menu usind drawitem and measure item in the form's code, but how would I create this in a usercontrol. If I inherit from System.Windows.Forms.MainMenu then I don't get the DrawItem even as that's in the System.windows.forms.MenuItem class.

    I'm fairly new to VB.NET and am just experimenting with this stuff.

    Thank in advanced...
    Micah Carrick
    Visual Basic 6 SP5
    Visual Basic.NET
    Quixotix Software
    [email protected]
    Download QCM 1.0 - Intelligent ActiveX Control Management

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Make an inherited MenuItem class instead.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207
    Okay, but then how do I have the MainMenu, as part of my control, utilize my class inherited from MenuItem rather than System.Windows.Forms.MenuItem?
    Micah Carrick
    Visual Basic 6 SP5
    Visual Basic.NET
    Quixotix Software
    [email protected]
    Download QCM 1.0 - Intelligent ActiveX Control Management

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I'm not sure I know what you mean. If you want to make a Mainmenu then you could make one of those as well. If you mean how will the normal Mainmenu control accept your custom Menuitem, as long as your extended MenuItem inherits the normal Menuitem it will accept it. To the Mainmenu it'll work just like a normal Menuitem, but your class can override some important events to change that without interfering with the Mainmenu control.

  5. #5
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    I think I have a similar problem. I have a context menu on a list that allows the user to add the selected item to a treeview. I want to customise the <Add> menu item so that is has a text box over the button allowing the user to enter the number of items to be added.

    Is this along the same lines? I don't want to hi-jack the thread.

    I've created a UserControl that inherits from MenuItem and added a text box to it.

    In my code I create a new ContextMenu and add my usercontrol to its MenuItems. However, the textbox in the UserControl doesn't appear on the screen.

    Any ideas?
    This world is not my home. I'm just passing through.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width