ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MouseMove & Click event over an image control (https://www.excelbanter.com/excel-programming/365763-mousemove-click-event-over-image-control.html)

furbiuzzu

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


furbiuzzu

MouseMove & Click event over an image control
 
uuhuhuhuhuh

really sorry for replying to my own post.....

acn anybody help me....

really need to solve this "bug"



All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com