gpt4 book ai didi

c# - 覆盖 OnPaint

转载 作者:行者123 更新时间:2023-11-30 14:20:50 26 4
gpt4 key购买 nike

如果我重写 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 { ... }

关于c# - 覆盖 OnPaint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/738694/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com