有人可以解释Form.resize事件 [英] Can someone explain the Form.resize event

查看:286
本文介绍了有人可以解释Form.resize事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个加载并正在运行的表单,但表单调整大小事件大约发射5次

我有代码根据表单大小调整控件等大小

我从form.minimized开始然后加载控件然后maxamize和位置控件

为什么如果多次点火或者我可以告诉它只在MAximize时触发

谢谢

Hi I have a form which loads and is working but the form resize event is firing about 5 times
I have code that resizes controls etc based on the form size
I begin with form.minimized then load controls then maxamize and position controls
Why should if fire so many times or can I tell it to fire only when at MAximize
Thanks

推荐答案

试试 http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(v = vs.110)的.aspx [ ^ ]。


用于在Windows应用程序中调整大小,您可以按照以下方式执行此操作

甚至可以捕获最大化/恢复事件双击窗口标题栏引起的WndProc方法没有。

将其复制并链接到表单上的Resize事件处理程序。

for resize in windows application you can do it on following way
and it even captures maximize/restore events caused by double-clicking the window titlebar, which the WndProc method does not.
Copy this in and link it to the "Resize" event handler on the form.
Private LastWindowState As FormWindowState = FormWindowState.Minimized
Private Sub Form1_Resize(sender As Object, e As EventArgs)

	' When window state changes
	If WindowState <> LastWindowState Then
		LastWindowState = WindowState



				' Maximized!
		If WindowState = FormWindowState.Maximized Then
		End If

				' Restored!
		If WindowState = FormWindowState.Normal Then
		End If
	End If

End Sub


这篇关于有人可以解释Form.resize事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆