如何制作自定义绘制可调整大小的容器? [英] How do I make an custom drawn resizable container?

查看:211
本文介绍了如何制作自定义绘制可调整大小的容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WinForms gui应用程序,它有很多方面,我想自定义绘制一些图形。这些区域将包含控件并可调整大小。我目前想从 TableLayoutPanel 继承并处理onpaint消息。

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?

推荐答案

任何Windows Forms控件都有一个Paint事件,你不必派生自己的类。但是,肯定,你可以,它帮助分区的代码。只需选择一个已经提供大部分需要的基类。在构造函数中将DoubleBuffered属性设置为true,并重写OnPaint。

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.

这篇关于如何制作自定义绘制可调整大小的容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆