[英]reducing the size of the selection box around a winforms custom control
我有一个基于标签控件的自定义控件。 我的问题是,当用户在设计模式下选择该自定义控件时,如何更改选择框的大小。 需要的是盒子太大,我需要使其变小。
同样,在我的情况下,将AutoSize设置为true也不起作用,选择框仍然太大。
您必须为控件创建基于ControlDesigner
的设计器,然后在OnPaintAdornments
事件中使用DrawFocusRectangle
方法。
ControlDesigner类-在http://msdn.microsoft.com/zh-cn/library/system.windows.forms.design.controldesigner.aspx上 扩展了控件的设计模式行为 。
扩展设计时支持 , 网址为http://msdn.microsoft.com/zh-cn/library/37899azc.aspx
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.design.controldesigner.onpaintadornments(VS.80).aspx上的 ControlDesigner.OnPaintAdornments方法
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.controlpaint.drawfocusrectangle.aspx上的 ControlPaint.DrawFocusRectangle方法 。
设计器中的选择框取决于(并且必须)取决于控件的大小。 如果要使其较小,则控件必须较小。 无法手动控制其大小或位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.