如何更改表单边框的粗细 [英] how can I change the thickness of a form border
本文介绍了如何更改表单边框的粗细的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在显示时更改表单边框的粗细。我的应用程序是使用VS2013在VB中编写的。有什么想法?
推荐答案
首先,你可以从可用的边界中选择一个: https://msdn.microsoft.com/en-us/library/system.windows.forms.form .formborderstyle%28v = vs.110%29.aspx [ ^ ]。
如果这还不够,你就是可以使用无边框窗体并使用重写的OnPaint
方法在客户区中绘制边框。要避免与表单内容交叉,请添加一些Padding
。但是如果你想以更准确和更通用的方式(比如,如果你为其他表单类开发通用基类),你可以通过重写Control.SetClientSizeCore $来调整客户端大小。 c $ c>,为你的边界增加一些空间:
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.setclientsizecore%28v=vs.110%29.aspx [ ^ ]。
-SA
First, you can choose one from the available borders: https://msdn.microsoft.com/en-us/library/system.windows.forms.form.formborderstyle%28v=vs.110%29.aspx[^].
If this is not enough, you can use borderless form and draw a border in the client area using overriddenOnPaint
method. To avoid intersection with the form's content, add somePadding
. But if you want to do it in more accurate and universal way (say, if you develop a universal base class for other form classes), you can use adjust the client size by overridingControl.SetClientSizeCore
, to make some extra room for your border:
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.setclientsizecore%28v=vs.110%29.aspx[^].
—SA
这篇关于如何更改表单边框的粗细的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文