C# – Scrollbar does not appear on Panel when lines drawn on it (C#)

cpanel

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 ;(

Best Answer

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.