改变WinForm边框的样式?
是否可以更改 WinForm 边框的样式?我知道,如果删除边框,就会失去调整程序大小的功能。因此,有没有办法改变它的样式,但保持它的大小可调?
Is it possible to change the style of a WinForm border? I know that if the border is removed, it takes away the functionality to resize the program. Therefore is there a way to change the style of it, but keep it resizable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你所寻求的并不简单,因为边界是由操作系统划定的。然而,CodePlex 上有一个库确实可以做到这一点。
在 Windows 窗体中绘制自定义边框
What you seek is not simple because the border is drawn by the operating system. However, there is a library on CodePlex that does make possible to do this very thing.
Drawing Custom Borders in Windows Forms
首先在InitializeComponent()中写入:
然后,使用与此类似的方法。在这种情况下,我的表单只能从右侧调整大小,但应该很容易从任何一侧调整大小:
First write this in the InitializeComponent():
Then, use a method similar to this. In this case, my form is only resizable from the right side, but should be easy to make it resize from any side:
我认为没有直接的方法可以做到这一点。
但是,您可以将表单边框样式设置为“无”。
并在您的表单中实现调整大小(我认为这并不困难)
I dont think there is a direct way to do this.
But, you could set the form border style to None.
And implement the resizing in your form(which I don't think its difficult)
PS:尚未测试
希望您已将 FormBorderStyle 设置为 None
P.S: Have not yet tested it
Hope you've set FormBorderStyle to None