Home > Software engineering >  Vb to detect where the mouse into the label tag
Vb to detect where the mouse into the label tag

Time:10-05

'the mouse moved to WEB zone
Private Sub LblWeb_MouseMove (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)

LblWeb. ForeColor=& amp; H8A7839 'color when the mouse move into WEB
LblWeb. MousePointer=99 'the mouse moved to the current situation of the WEB of the mouse, hand type
LblWeb. MouseIcon=LoadPicture (" d: \ vb \ photos \ mouse cur ") 'mouse shape picture

End Sub


This is how to detect, there is no if statements, although there are x, y coordinates, but how to know the mouse near the label tag

CodePudding user response:

Call LblWeb_MouseMove place

CodePudding user response:

What on earth are the mouse near range can only be detected

CodePudding user response:

Design mode selected LblWeb there will be a border, this is LblWeb area, according to the need to adjust the size,

CodePudding user response:

Private Sub LblWeb_MouseMove (Button As an Integer, Shift the As an Integer, As Single x, y As Single)
Dim MouseEnter As Boolean 'mouse into the sign bit
MouseEnter=(0 & lt;=x) And (x & lt;=LblWeb. Width) And (0 & lt;=y) And (y & lt;=LblWeb. Height)
'to calculate the movement of the mouse is inside the image
If MouseEnter Then 'mouse has entered the
SetCapture LblWeb. The hWnd
The mouse has left
the Else 'ReleaseCapture
End the If
End Sub
Hope this to inspire you and help!
  • Related