以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 动态加载窗口 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=169414) |
-- 作者:wgqcool -- 发布时间:2021/6/15 21:08:00 -- 动态加载窗口 做了一个liform的内部函数,用于内嵌窗口,代码如下: Dim Panel As WinForm.Panel = Args(0) \'窗口容器 Dim Form As WinForm.Form = Forms(Args(1)) \'要加载的窗口 Form.Show(-1000,-1500) Form.BaseForm.TopLevel = False Form.BaseForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Form.BaseForm.Dock = System.Windows.Forms.DockStyle.Fill Panel.BaseControl.Controls.Clear Panel.BaseControl.Controls.add(Form.BaseForm) 主窗口新建了3个button, 主窗口的afterload事件上,用PerformClick做了触发: Dim bt1 As WinForm.Button = e.Form.Controls("Button1") bt1.PerformClick Dim bt2 As WinForm.Button = e.Form.Controls("Button2") bt2.PerformClick Dim bt3 As WinForm.Button = e.Form.Controls("Button3") bt3.PerformClick 第一个button,就是调用liform函数 Functions.Execute("liform",e.Form.Controls("Panel1"),"产品筛选窗口") ’Functions.Execute("liform",e.Form.Controls("Panel2"),"分页窗口") 问题是:主窗体上有2个panel,需要分别调用2个内嵌窗口,但两个内嵌窗口都用liform调用的时候,button2和button3的performclick事件触发不了,如果只调用一次liform,button2和button3的performclick是正常的,请教老师,这是什么原因呢? |
-- 作者:有点蓝 -- 发布时间:2021/6/15 22:53:00 -- e.Form.Controls("Button1") 改为具体的窗口名称 Forms("xx窗口").Controls("Button1")
|
-- 作者:wgqcool -- 发布时间:2021/6/16 16:00:00 -- 老师,按照您的方法,改成: Dim bt1 As WinForm.Button = Forms("产品目录").Controls("Button1") bt1.PerformClick Dim bt2 As WinForm.Button = Forms("产品目录").Controls("Button2") bt2.PerformClick Dim bt3 As WinForm.Button = Forms("产品目录").Controls("Button3") bt3.PerformClick 情况依旧。
[此贴子已经被作者于2021/6/16 15:59:44编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/6/16 16:13:00 -- 那我也不知道什么原因了。另外这种嵌入窗口到其它窗口的用法是不受官方支持的,有问题只自己解决了 |