views:

33

answers:

1

Hi all,

I need to place icons on a map image. Since the map image is bigger than my screen resolution 1280 x 1024, a horizontal scroll bar is shown.

I use Location x and y to place icons, but the problem is: placing an icon at location (0, 0) when the horizontal scroll bar is at left-most position is different from when the horizontal scroll bar is at right-most position...

If I move scroll bar to x-axis(right) 10 then placing an icon at (0, 0), should be (0, 0) but it is placed at (10, 0).

in this case, is there any different approach? or should I consider how much scroll bar has moved? if so, how do I do it?

hope my explanation makes sense.

Thanks,

A: 

Yes, it's sort of annoying. If your container Control supports scrolling, then you have to account for its current position whenever you set the Location on a child Control. Suppose you are using autoscroll and you want to put a child at x, y. Then your container Control could use code like this:

Point p = new Point(x, y);
p.Offset(AutoScrollPosition);
child.Location = p;
Paul A Jungwirth