老师好!主窗口(模式窗口)的afterload代码如下,不加入最后一行代码没有问题,加入后启动窗口就死机,必须关机重启,任务管理器也打不开。
如果不使用最后一行代码,采用先打开主窗口,再点击“But首页”按钮,是不会有问题。
这是什么原因?
1、afterload代码:
AddHandler e.Form.Panel.MouseDown,AddressOf Panel_MouseDown '无边框移动
e.form.BaseForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
e.Form.BaseForm.ShowInTaskbar = True
e.Form.BaseForm.Owner = BaseMainForm
......
'e.Form.Controls("But首页").PerformClick()
-----------------------
2、“But首页”按钮代码:
Dim PB As WinForm.Panel = e.Form.Controls("Panel1")
Dim Name As String = "首页" '只要修改一下这里就行 ,窗口的名称
Forms(Name).OPEN(-1000,-1500)
Forms(Name).BaseForm.TopLevel = False
Forms(Name).BaseForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Forms(Name).BaseForm.Dock = System.Windows.Forms.DockStyle.Fill
PB.BaseControl.Controls.Clear
PB.BaseControl.Controls.add(Forms(Name).BaseForm)