How do I make an custom drawn resizable container?

2019-08-26 05:35发布

I have a WinForms gui application which has a number of areas to it which I'd like to custom-draw some graphics. These areas would contain controls and be resizeable. I'm currently thinking of inheriting from a TableLayoutPanel and handling onpaint messages.

Does this sound like a good way to go or are there other/better options?

1条回答
Fickle 薄情
2楼-- · 2019-08-26 05:55

Any Windows Forms control has a Paint event, you don't have to derive your own class. But sure, you can, it helps partitioning the code. Just pick a base class that already provides most of what you need. Set the DoubleBuffered property to true in the constructor and override OnPaint.

查看更多
登录 后发表回答