Windows窗体-Visual Studio用户控件刷新 [英] Windows Forms - Visual Studio User Controls Refresh

查看:194
本文介绍了Windows窗体-Visual Studio用户控件刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在Windows Forms项目中,我创建了一个自定义标签控件,在其构造函数中将BackColor设置为Red.现在,当我将此控件拖到窗体中时,设计器将创建属性MyLabel.BackColor = Red.当我在构造函数中更改颜色时,是否有一种自动刷新此属性的方法,导致现在仍为红色?您需要重建控件.这意味着您上一次拖曳"的控件现在已经变成了完全不同的控件.这样您就可以看到旧颜色.


Hi,
In Windows Forms project, I create i.e. a custom label control with BackColor set to Red in it''s constructor. Now, when I drag this control into form, the designer creates property MyLabel.BackColor = Red. Is there a way to refresh this property automatically, when I change the color in the constructor, cause now it remains Red ?

解决方案

If you change the color in constructor then you need to rebuild the control. That means your last time ''dragged'' control is now diferent control alltogether. So you get to see the old color.


这篇关于Windows窗体-Visual Studio用户控件刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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