How can I hide the resizing handles of a control in Windows Forms?

佐手、 提交于 2019-11-28 04:17:00

问题


I have an UserControl and would like to hide the resizing handles in design-time, just like the TextBoxControl, that has only two handles (left and right ones)... the height of the textbox is fixed, unless you say it is multiline. In that case, the textbox shows all nine resizing handles.


回答1:


You need to implement a custom designer (ControlDesigner) for your control and then override the SelectionRules property.

Useful reference:

Extending Design-Time Support




回答2:


I think you would need to draw your own control and define the size in the class. I believe if you inherit a user control you'll always have the option to resize.



来源:https://stackoverflow.com/questions/2494865/how-can-i-hide-the-resizing-handles-of-a-control-in-windows-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!