Sign in to follow this  

Mouse Troubles

Recommended Posts

So I'm attempting to make a tile editor, which I've done before in other languages but I'm having troubles getting the mouse position...

I have 2 XNA sections on the screen. The map area and the tileset area. I can accurately get the mouse position of the tile area but not the map area. The position on the map area is always random and often negative.

I use the same method for both:

System.Drawing.Point pos = this.tileArea.PointToClient(System.Windows.Forms.Control.MousePosition);

//Doesn't Work
System.Drawing.Point pos = this.mapArea.PointToClient(System.Windows.Forms.Control.MousePosition);

Any clue what the problem is?

Share this post

Link to post
Share on other sites
No clue what the problem was but I worked around it by using XNA's method of getting the mouse position, then using this.PointToClient() to convert it, then subtracting the location of the panel containing the XNA render section. : /

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this