[英]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.