View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
furbiuzzu furbiuzzu is offline
external usenet poster
 
Posts: 57
Default MouseMove & Click event over an image control

hi all,

this is my problem:

Inside an excel sheet userform i've put some images (control.Image)
When the form is activated dragging the mouse over a single image i
change the image itself switching between 4 different .bmp files
according to mouse position over the active control. (this works fine).
the problem is when i casually click over the image. An unwanted event
is generated and the image is "locked", even moving the mouse there's
no possibility to visualize other images related to the active control.
is like an unwanted event related to clicking is generated

How can i solve thise huge problem'?

thanks to all. fulvio

here you have some code...

orient1, orient2 etc are images
orientation is the routine switching the images
Private Sub orient2_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Dim i As Integer
i = 2
Call orientation(X, Y, i)
End Sub

Private Sub orient3_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Dim i As Integer
i = 3
Call orientation(X, Y, i)

End Sub


Private Sub orientation(X, Y, i)
Dim left, left1, left2, left3, left4 As Integer
Dim picture As String

picture = Worksheets("foglio1").Range("Az" & i).Value

Select Case Worksheets("foglio1").Range("Az" & i).Value

Case "terz dx"

left1 = 0
left2 = 16
left3 = 32
left4 = 48

If X < left2 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " norm.bmp")
lineup.Controls("orient" & i).ControlTipText = "norm"
End If
If X = left2 And X < left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " dif.bmp")
lineup.Controls("orient" & i).ControlTipText = "dif"
End If
If X = left3 And X < left4 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " off.bmp")
lineup.Controls("orient" & i).ControlTipText = "off"
End If
If X = left4 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " TM.bmp")
'lineup.Controls("orient" & i).ControlTipText = "tm"
If i 4 Then
lineup.Controls("orient" & i).ControlTipText = "ext"
Else
lineup.Controls("orient" & i).ControlTipText = "tm"
End If
End If

Case "terz sx"

left1 = 0
left2 = 16
left3 = 32
left4 = 48

If X < left2 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " tm.bmp")
'lineup.Controls("orient" & i).ControlTipText = "tm"
If i 4 Then
lineup.Controls("orient" & i).ControlTipText = "ext"
Else
lineup.Controls("orient" & i).ControlTipText = "tm"
End If
End If
If X = left2 And X < left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " dif.bmp")
lineup.Controls("orient" & i).ControlTipText = "dif"
End If
If X = left3 And X < left4 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " off.bmp")
lineup.Controls("orient" & i).ControlTipText = "off"
End If
If X = left4 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " norm.bmp")
lineup.Controls("orient" & i).ControlTipText = "norm"
End If

Case "dc dx"

left1 = 0
left2 = 20
left3 = 44

If X < left2 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " ext.bmp")
If i 4 Then
lineup.Controls("orient" & i).ControlTipText = "tm"
Else
lineup.Controls("orient" & i).ControlTipText = "ext"
End If
End If
If X = left2 And X < left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " off.bmp")
lineup.Controls("orient" & i).ControlTipText = "off"
End If
If X = left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " norm.bmp")
lineup.Controls("orient" & i).ControlTipText = "norm"
End If

Case "dc sx"

left1 = 0
left2 = 20
left3 = 44

If X < left2 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " norm.bmp")
lineup.Controls("orient" & i).ControlTipText = "norm"
End If
If X = left2 And X < left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " off.bmp")
lineup.Controls("orient" & i).ControlTipText = "off"
End If
If X = left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " ext.bmp")
If i 4 Then
lineup.Controls("orient" & i).ControlTipText = "tm"
Else
lineup.Controls("orient" & i).ControlTipText = "ext"
End If
End If

Case "att dx"

left1 = 0
left2 = 20
left3 = 44

If X < left2 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " ext.bmp")
lineup.Controls("orient" & i).ControlTipText = "ext"
End If
If X = left2 And X < left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " dif.bmp")
lineup.Controls("orient" & i).ControlTipText = "dif"
End If
If X = left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " norm.bmp")
lineup.Controls("orient" & i).ControlTipText = "norm"
End If

Case "att sx"

left1 = 0
left2 = 20
left3 = 44

If X < left2 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " norm.bmp")
lineup.Controls("orient" & i).ControlTipText = "norm"
End If
If X = left2 And X < left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " dif.bmp")
lineup.Controls("orient" & i).ControlTipText = "dif"
End If
If X = left3 Then
lineup.Controls("orient" & i).picture = LoadPicture("C:\Documents and
Settings\furbiuzzu\Desktop\immagini mytym\" & picture & " ext.bmp")
lineup.Controls("orient" & i).ControlTipText = "ext"
End If

End Select

End Sub