How can I find out in which half of the picturebox the mouse is?
How can I find out in which half of the picturebox the mouse is(upper or lower)?
Re: How can I find out in which half of the picturebox the mouse is?
Use this as an example:
VB Code:
Option Explicit
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Y > Picture1.Height / 2 Then
Picture1.BackColor = vbBlue
Else
Picture1.BackColor = vbRed
End If
End Sub
Re: How can I find out in which half of the picturebox the mouse is?
Thanks, if I change Y to X then I'll have the resuults according to x right(like divided with a vertical line)?
Re: How can I find out in which half of the picturebox the mouse is?
That was my mistake. I was using X instead of Y, but Yes if you use Width instead of Height, you can get the left or right side.