picture box display context menu

SpiN9823
01-25-2004, 05:11 AM
how do i make a picture display a context menu on left click? ive been tryin to figure this out for awhile but nuttin i try seeems to work!!
thx

Machaira
01-26-2004, 07:39 AM
Usually a context menu is associated with a right click. Steps:

1) Create the context menu using the ContextMenu control in the Toolbox.
2) Set the ContextMenu property of the PictureBox to the control you just created.

SpiN9823
01-27-2004, 04:20 PM
i tried that before i posted this but you have to right click it... is there a way to make it left click?

VBJoe
01-27-2004, 06:54 PM
I wouldn't suggest you open a context menu with a left click, things like that make users mad. But if you insist:

Private Sub txtOutput_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtOutput.Click
Dim p As System.Drawing.Point
p.X = 100
p.Y = 100
ContextMenu1.Show(txtOutput, p)
End Sub

I don't mind helping you, but I need to know: have you actually read a book on .NET? Have you any previous programming experience? I ask because the Click event has been around for a long time...

SpiN9823
02-05-2004, 03:31 PM
yes i have read a book about VB.NET... and yes i have programming experience

Machaira
02-06-2004, 06:11 AM
You might want to think about reading a book on GUI design. As VBJoe says, a left click should almost never be used to display a context menu. I believe it's ICQ that does this and it ticks me off.

SpiN9823
02-08-2004, 06:17 AM
thanks machaira and vbjoe

KEITHSTER
03-01-2004, 01:25 PM
how do i make a picture display a context menu on left click? ive been tryin to figure this out for awhile but nuttin i try seeems to work!!
thx

add a context menu control to project named contextmenu1 ( you must add menu items ( ie words describing menus ).. if you don't, the contextmenu will not popup.


basically this....

sub picturebox1_click

if picturebox1.mousebutton = mousebuttons.left then

picturebox1.contextmenu = contextmenu1

end if

end sub

hope this helps.

SpiN9823
03-01-2004, 01:55 PM
Yes, that did help, thanks.

SpiN9823
03-01-2004, 05:08 PM
And VBJoe and Machaira, I'm making the PictureBoxes look like a menu because the images look better, but thanks anyway.

greg85374
03-14-2004, 08:40 AM
Hey ive looked for 3 days no for the code in vb..to simply add an item to the webbrowser right click menu...similar to what he's doing..can anyone help me there?..this is the 3rd forum ive posted this in..still no response..I want to simply add the option "Open in new tab" to the context menu...?plz HELP!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum