Cursor position Error

hi,
I have have developed an application which is working fine in my laptop (which has a wide-screen 15.4 in)
and I have taken this application to another PC (which has a 17 in screen)
now I have user-friendly button which is working in my laptop but not in PC .. what I am doing is that there is a picture box control changing it's image depending on the cursor position that I put it in my code ..
now is there any or equation that I can do to avoid changing the absolute position values ?
here is a code sample:
private void WindowStatePicBox_MouseMove(object sender, MouseEventArgs e) 
        {
            if (!isPressed)
            {
                if (((Cursor.Position.X >= 933) && (Cursor.Position.X <= 975)) && (Cursor.Position.Y <= 139))
                    WindowStatePicBox.Cursor.Image = global::FRSystem.Properties.Resources._2;
                if (((Cursor.Position.X >= 908) && (Cursor.Position.X < 933)) && (Cursor.Position.Y <= 139))
                    WindowStatePicBox.Image = global::FRSystem.Properties.Resources._3;
                if (((Cursor.Position.X < 908) || (Cursor.Position.X > 975)))
                    WindowStatePicBox.Image = global::FRSystem.Properties.Resources._1;
                if(Cursor.Position.Y > 139)
                    WindowStatePicBox.Image = global::FRSystem.Properties.Resources._1;
            }
        }

Open in new window

Ameerh24Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

elvirbrkCommented:
I think that MouseEventArgs contains mouse location on form, so you can combine that with picture box location and size on form in order to achieve desired behavior. All those values are relative to form and not to screen. This way you don't need to use mouse absolute position.
0
bhmahlerCommented:
you should be using e.Location not cursor position.  The mouse eventargs contains the location of the mouse in respect to your form and controls.  when using Cursor.Position you need to use your control and call PointToClient with the position.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.