开发者

How to paint on Form at Design Time?

If I have a UserControl and override OnPaint I can do what I want there and when I add that UserControl to a Form in designer in Visual Studio 2010 the OnPaint method is c开发者_开发知识库alled and the user control is painted and viewed in the designer as I want.

The question is can I do that with a Form not with an UserControl? How can I draw on Form that designer shows them?


The designer creates your form's base class; it doesn't create your form itself.
Any code in your form class itself will not run in the designer.

You need to make a separate base class that inherits Form and paints itself.
You will then see the painting in the designer of any form that inherits the base class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜