PDA

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


vbBlurry
09-18-2002, 06:37 AM
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!!

oracleguy
09-19-2002, 01:02 AM
For number 1:
It's actually surprisingly easy to do. Just add this code to your image(s) mousedown event


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.

vbBlurry
09-19-2002, 02:11 AM
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???

:confused:

oracleguy
09-19-2002, 02:26 AM
Yeah for the menu that you want to open up the form, just add the appropriate code so like:


Sub mOpenForm_Click ()
frmOtherForm.show
End Sub

vbBlurry
09-19-2002, 04:53 PM
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??

oracleguy
09-20-2002, 05:37 AM
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.

vbBlurry
09-22-2002, 04:04 PM
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 ??
:confused:

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