right click

DGWired
11-14-2002, 12:50 PM
I have a picture box that I need to have left-click and right click functions on. If i use Picture1_Click() it does the same thing no mater if it was a right r a left click.

How can I have it do one thing on a left click and another on a right click?


Thanks
Daniel

PrOpHeT
11-14-2002, 12:54 PM
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
if button = vbleftbutton then
if button = vbrightbutton then
End Sub

Lar_19
11-14-2002, 12:57 PM
Use the MouseDown event and check the button argument...
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
MsgBox "Right-Click"
End If
End Sub
Hope this helps,
L

DGWired
11-14-2002, 01:01 PM
cool that worked

Thanks

shmoove
11-14-2002, 01:15 PM
Just a quick GUI tip. It is usually better to use the MouseUp instead of MouseDown for clicking. MouseDown is better for dragging stuff (ie, resizing controls).

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum