need some help with windows forms coordinates please!

Started by
4 comments, last by unbird 14 years ago
Hey, So I'm trying to make an editor for a 2d game using tiles/blocks...a level editor...thought this part was going to be easy..turns out I don't know jack about windows forms and how Microsoft has things set up, I'm using XNA btw, which, makes things very easy and much less time consuming if you are lacking in the framework detail know how...any way, my problem is that I can't for now, do two things. (One)I don't know why if you draw an image to the screen in a windows form at say location 200X by 200Y then when you scroll down much lower using the autoscrollbar and then redraw...the image still pops up at 200X by 200Y (of the form)...even though I've scrolled down or away much lower, I thought I'd be moving away from 200X by 200Y if I used the scrollbar vertically. Basically what I'm aiming for is a program that lets me lay out certain types of images anywhere inside a windows form so that I can see beforehand what the "level" will look like, but I'm having this scrollbar issue right now and I'm stuck...also(two) I can't seem to get a mouseMove event going using s splitcontainer but in form1...my only form...its works, the framework autogenerates the code for me and I just edit it, but when I try to swap in a splitContainer_Panel2 object instead of a form1 object the mouse events don't work but throw no errors...I'm lost on this, please any help would MUCH be appreciated.
Advertisement
I've thought of a work around that may work...I really thought that when you scrolled down using scrollbars, the in-window coordinates would change and not stay the same..seems the objects inside the window themselves move but the coordinates stay the same?
Maybe invoke the magick of paragraphs and proper formatting to get replies ;)
nah...ill just take it that no one knows, or has the time..its ok though.
Quote:Original post by noirone
nah...ill just take it that no one knows, or has the time..its ok though.


I don't want to be blunt, but I doubt that, and bet you could get more input and actual readers by increasing the readability of your post.
The AutoScroll-logic and the ScrollBars of a ScrollableControl are for positioning the child controls. When manually drawing, i.e. through the Paint event handler, this scroll-offset will be ignored (origin will stay at the top left of your control). You can either offset all your drawing calls by the scroll-offset or set the Graphics.Transform properly prior to your draw calls.

Hope that helps.

This topic is closed to new replies.

Advertisement