Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to right-click on the image to open up a menu in visual basic?

    Hi! Any kind soul out there know abt visual basic? I got some problems.

    1) In my program during run-time, I dun know how to right click on the image and open up a menu then open up a form frm the menu?

    2) To draw lines and adjust the length of the line during run-time

    Thanks in advance!!

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    For number 1:
    It's actually surprisingly easy to do. Just add this code to your image(s) mousedown event

    Code:
    If Button = 2 Then 'If it was a right click display menu
        Me.PopupMenu Me.mPopup
    End If
    Now, mPopup is a menu in the program. Just add it and its child elements in from the menu editor. And to get mPopup to not show up on the form in your menus, just uncheck the visible property from the menu editor.
    OracleGuy

  • #3
    New Coder
    Join Date
    Sep 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hey thanks for your help!!

    But i was wondering during run-time, after i right-click and the menu is display. Then, frm the menu, is it possible that i can open up a form???


  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Yeah for the menu that you want to open up the form, just add the appropriate code so like:

    Code:
    Sub mOpenForm_Click ()
         frmOtherForm.show
    End Sub

  • #5
    New Coder
    Join Date
    Sep 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeap..Thanks! I have done it wif ur help!

    Another prob, if it is possible to draw lines and the lines are resizeable like in the paintbrush during run-time??

  • #6
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    I know if you put a line in during design time, you can resize it during runtime, as for creating a new one.... hmmm you got me stumped for the moment.

    But to resize it during runtime, you modify it's width and height properties, and if you want to move it you can change it's left and top properties as well.

  • #7
    New Coder
    Join Date
    Sep 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hiz..i think can forget abt tat part.. anyway, thanks

    now got another prob is i dunno how to drag image from a treeview to a form/listview ??


    Hope anyone out there can help... Thanks a lotz ppl..


  •  

    Posting Permissions

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