开发者

GDI+ Problem encountered in drawing multiples rectangles on the form

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.


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 :)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜