tags:

views:

1009

answers:

2

I want to draw some lines and rectangles on a panel. Sometimes it does not fit in panel and I want the scroll bar to appear. I set AutoScroll property to true, but it doesn't work ;(

+2  A: 

Set the panel's AutoScrollMinSize property to a something larger than the panel's real dimensions (for example, if your panel is 300 x 200, set the AutoScrollMinSize property to 900 x 600). This will cause both scrollbars to appear, and you should be able to draw on the larger surface.

MusiGenesis
Thanks a lot. It works :)
Sali Hoo
+2  A: 

You will need to tell the panel control that you are drawing outside of the visible bounds by setting the AutoScrollMinSize property. But another, perhaps simpler, solution would be to have your panel contain another panel control in which you do the drawing. Then you can simply resize that inner panel to fit your drawing and the outer panel will automatically provide the scrolling as necessary.

Fredrik Mörk