Results 1 to 4 of 4

Thread: How can I find out in which half of the picturebox the mouse is?

  1. #1

    Thread Starter
    Addicted Member kill_bill_gates's Avatar
    Join Date
    Oct 2004
    Posts
    222

    Question 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)?
    "Quis custodiet ipsos custodes?"
    Juvenal
    Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
    I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
    -=Joey Jordison R0CKS!! =-

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How can I find out in which half of the picturebox the mouse is?

    Use this as an example:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    4.   If Y > Picture1.Height / 2 Then
    5.     Picture1.BackColor = vbBlue
    6.   Else
    7.     Picture1.BackColor = vbRed
    8.   End If
    9. End Sub

  3. #3

    Thread Starter
    Addicted Member kill_bill_gates's Avatar
    Join Date
    Oct 2004
    Posts
    222

    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)?
    "Quis custodiet ipsos custodes?"
    Juvenal
    Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
    I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
    -=Joey Jordison R0CKS!! =-

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width