当前位置 : 主页 > 编程语言 > c语言 >

c# – 覆盖OnPaint

来源:互联网 收集:自由互联 发布时间:2021-06-25
如果我重写OnPaint并在控件上绘制一个正方形,那么当我在设计器中预览时,如何让e.graphics.draw …出现? http://msdn.microsoft.com/en-us/magazine/cc164048.aspx http://msdn.microsoft.com/en-us/magazine/cc164145.a
如果我重写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 { … }

网友评论