加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 覆盖OnPaint

发布时间:2020-12-16 01:30:20 所属栏目:百科 来源:网络整理
导读:如果我重写OnPaint并在控件上绘制一个正方形,那么当我在设计器中预览时,如何让e.graphics.draw …出现? 解决方法 http://msdn.microsoft.com/en-us/magazine/cc164048.aspx http://msdn.microsoft.com/en-us/magazine/cc164145.aspx While you could manual
如果我重写OnPaint并在控件上绘制一个正方形,那么当我在设计器中预览时,如何让e.graphics.draw …出现?

解决方法

http://msdn.microsoft.com/en-us/magazine/cc164048.aspx

http://msdn.microsoft.com/en-us/magazine/cc164145.aspx

While you could manually register with
Control.OnPaint to add your design
time UI,you’ll find that overriding
OnPaintAdornments is a better option
because it is only called after the
control’s design-time/run-time UI is
painted,letting you put the icing on
the cake (see Figure 20). Simply
adding DesignerAttribute to the
ClockControl class completes the
association: Copy Code

[ Designer(typeof(ClockControlDesigner)) ] class ClockControl : Control { … }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读