如何隐藏 Windows 窗体中控件的大小调整手柄?
我有一个 UserControl,想在设计时隐藏调整大小手柄,就像 TextBoxControl 一样,它只有两个手柄(左手柄和右手柄)...文本框的高度是固定的,除非你说它是多行的。在这种情况下,文本框会显示所有九个大小调整手柄。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要实现一个自定义设计器(ControlDesigner) 为您的控件,然后覆盖
SelectionRules
属性。有用的参考:
扩展设计时支持
You need to implement a custom designer (ControlDesigner) for your control and then override the
SelectionRules
property.Useful reference:
Extending Design-Time Support
我认为您需要绘制自己的控件并在类中定义大小。我相信如果您继承了用户控件,您将始终可以选择调整大小。
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.