本文介绍了达到限制宽度大小时,禁用调整大小的表单宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
您能帮助我如何禁止用户重新调整表单宽度吗?
场景:
我想在边界或极限宽度处设置给定宽度
用户可以调整大小.
用户可以重新调整表单大小,除非达到我的表单极限宽度...
你能帮我吗...
抱歉英语不好...:O
在此先感谢....
Hello Guys,
Can you help me on how to disable the user to re-size the form width.
Scenario:
I have want to set a given width where it is the boundary or the limit width where
the user can re-size.
User can re-size the form except when it have reach to my limit width of the form...
Can you please help me...
Sorry for poor English... :O
Thanks in advance....
推荐答案
void Resize(object sender, eventArgs e)
{
if (this.Width >= MaxWidth)
{
this.Width = MaxWidth;
}
}
希望这会有所帮助
[更新]
这是VB版本
Hope this helps
[UPDATE]
Here is a VB version
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
Dim maxWidth As Integer = 800
If Me.Width >= maxWidth Then
Me.Width = maxWidth
End If
End Sub
祝你好运
Good Luck
这篇关于达到限制宽度大小时,禁用调整大小的表单宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!