Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a level editor with Winforms for my XNA game, but I have run in to a small issue. I have a XNA game class running in a picturebox control, but when I have my mouse being tracked in the control the X position of the mouse is tracked fine but the Y position is not tracked correctly. The further from the top of the control the less the mouse is being tracked. I thought that setting the Window Handle of the mouse was the problem, but that is set correctly.

share|improve this question

closed as off-topic by Josh Petrie Apr 7 '14 at 15:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

You're going to have to give us more to go on. What debugging steps have you taken already? – Byte56 Jan 15 '13 at 21:42
There isn't really much in the way of debugging that can be done the setup of the project wasn't even that hard to get the Game1.cs to run in the picturebox. I used the winforms sample from… I don't know if this way works with mouse.GetState all that well though. Should I just use another winforms method? – user25179 Jan 16 '13 at 0:59
@user25179 Please provide the code where you're checking the coordinates of the mouse pointer. As for debugging, you could just display the current coordinates as text on the game screen. – Marton Jan 18 '13 at 12:08
I have solved the problem. the mouse position was still being calculated for the original window that is created buy the XNA game class. And so where ever that window is the mouse is tracked at that position. So I had to modify my editor to be positioned where ever the XNA game window is. – user25179 Jan 21 '13 at 19:35
can you provide an example as to how you got your mouse input to work with XNA/winform? – ChocoMan Aug 19 '13 at 5:33

Browse other questions tagged or ask your own question.