views:

25

answers:

2

I whant to draw a table in C# Windows Forms using GDI+. When the number of rectangles is too large for all rectangles to be displayed on the form, it does not scroll. And can not access those who did not fit the form.

What I need to do to see everything I drawing on the form?

Thanks.

+1  A: 

Use a Panel or UserControl for drawing, make it large enough that your complete table fits and then let the form auto-scroll.

A component doesn't care about what you draw on it or where. Scrollbars do not magically appear just because you're drawing something in a place where it can't be seen. So either use a component lage enough that your drawing fits (you should know how large it gets) and let the container scroll. Or use scrollbars directly and translate your drawing accordingly. The latter option is more complicated, though :)

Joey
+1  A: 

Create a UserControl where you draw your table. Set its Height and Width to the full height and width (i.e. not restricted to the form size, but related to the table size). Now put your control in a Panel and activate scroll bars there.

Timores