Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override OnPaint

If I override OnPaint and draw a square on the control, how do I get that e.graphics.draw... to show up when I'm previewing it in the designer?

like image 360
maxfridbe Avatar asked Nov 21 '25 00:11

maxfridbe


1 Answers

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 { ... }

like image 84
Jason Coyne Avatar answered Nov 22 '25 16:11

Jason Coyne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!