Results 1 to 6 of 6

Thread: Right-Click pop-up HELP!!!

  1. #1
    B2E
    Guest

    Right-Click pop-up HELP!!!

    o.k. i am writing a program and i want to have a menu pop-up by the mouse when i right click. how exactly do i do that.I have no idea where to start,could someone help me out. Thanks!!

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    right click popup code. Just put this in the contructor for your form. Inhertiance takes care of the the detecting right click so you dont need to code that part.

    Code:
    Dim mnuContext As ContextMenu
    Me.mnuContext = New ContextMenu()
    mnuContext.MenuItems.Add(New MenuItem("Unzip", New EventHandler(Me.mnuUnzip_Clicked)));
    controltorightclickon.ContextMenu = mnuContext
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    B2E
    Guest

    put it were?

    o.k i see the code but everywere i put it it either showe errors or it does not work. Now i know you know what you are doing so it has to be me doing something wrong.could you tell me were exactly to put it?

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    it needs to be put in the contructor of the form..in other words the Sub New()
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    B2E
    Guest

    what i need to happen

    i want to run be running a thread behind the form that will detect a right click of the mouse at any point on the form and put the same contextmenu up for everything right clicked. i do not know how to detect a right mouse click for everything on a thread that is running seperately from the form. what can i do??????

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    controltorightclickon.ContextMenu = mnuContext

    just do that for every control that will use the same menu.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

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