如何在设计时间内看到自定义控件属性的变化 [英] how to immidiatly see the changes of custom control property in design time

查看:83
本文介绍了如何在设计时间内看到自定义控件属性的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有自定义属性bordercolor的自定义标签控件。
在VS2010的de属性窗口中的
你可以更改标签的bordercolor

自定义标签覆盖了onPaint活动



I have a custom label control with a custom property bordercolor.
in de property window of VS2010 you can change the bordercolor of the label
The custom label overrides the onPaint event

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)

     MyBase.OnPaint(e)

     ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, _BorderColor, 1, _
         ButtonBorderStyle.Solid, _BorderColor, 1, ButtonBorderStyle.Solid, _BorderColor, 1, _
         ButtonBorderStyle.Solid, _BorderColor, 1, ButtonBorderStyle.Solid)

 End Sub





如果改变边框颜色VS2010并不会无变化地改变颜色形式类似于标签的标准backcolor属性。我首先要点击表单查看我所做的更改。



我怎样才能在VS2010的设计模式中看到变化



If a change the bordercolor VS2010 does not immidiatly change the color on the form like the standard backcolor property of the label. I first have to click on the form to see the change i've made.

How can i see the changes immidiatly in design mode in VS2010

推荐答案

在自定义属性设置器中,调用控件上的Invalidate()方法。
In the custom property setter, call the Invalidate() method on the control.


对于designTime,您必须重建控件以刷新它在设计师。
For designTime you have to rebuild the control to refresh it in the designer.


这篇关于如何在设计时间内看到自定义控件属性的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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