MDI获取FormClosing但非子表单也打开。 [英] MDI gets FormClosing but non-Child forms also open do not.

查看:61
本文介绍了MDI获取FormClosing但非子表单也打开。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MDI表格,有时是儿童表格,有时表格是

不是

如果我关闭应用程序,孩子会形成关闭和关闭事件发生之后 ..


但是同样打开的常规表单也不会收到该事件。这是

是否有子表单打开是否正确。


MDI表单始终处于打开状态并始终获取事件。


FormClosing的工作原理相同。

如果有一个MDI表单,其他非子表单确实如此,那么
就不会收到这些事件。


这是对的???



谢谢

解决方案

我生成了一个简单的解决方案,只有一个MDI表单和一个非MDI

非MdiChild表单。


我打开Mdi表单的Load事件中的常规表单。 Mdi表单是启动时的



两个FormClosing事件都包含一个控制台写行语句。


当我单击X退出应用程序我只看到Mdi

FormClosing事件的输出。


没有来自常规表单。


它真的很简单,生成解决方案可能更容易,然后

下载它。

但是我可以上传的地方所以你们有些专家可能会发表评论 -

我不想附上它。


我想这种行为可能是设计但似乎不太可能。


当他们被依赖时,没有得到关闭和关闭事件非常重要。



学术" < ac ************ @ a-znet.com写了留言

新闻:%2 *************** *@TK2MSFTNGP02.phx.gbl ...


>我有一个MDI表格,有时是儿童表格,有时表格是
既不是


如果我关闭应用程序,孩子将关闭并关闭事件发生

接着是接收事件的Mdi表格..


但是同样打开的常规表单也不会收到该事件。无论是否打开子表格,这都是真实的。


MDI表单始终处于打开状态并始终获取事件。


FormClosing的工作方式相同。


如果有一个MDI表单,其他非子表单似乎是真的

not收到活动。


这是正确的???



谢谢





当你关闭MDI表格时,为什么要关闭非MDI子表单?它不是MDI表格的孩子,

并且据他所知,它与MDI表格无关。

。关闭MDI表单将关闭

子项(但直到MDI表单关闭之后)

因为它们是相关的。


如果要关闭非MDI子窗体,

则必须在FormClosed

或关闭的MDI窗体的FormClosing事件中放置一些内容。 />
具体来说。


如果您希望在正常

表单关闭时关闭MDI表单,反之亦然适用。


Robin S.

------------------------- ---------


"学术" < ac ************ @ a-znet.comwrote in message

news:OU ************** @ TK2MSFTNGP03 .phx.gbl ...


>我生成了一个只有MDI表单和非MDI
非MdiChild表单的简单解决方案。


我在Mdi表单的Load事件中打开常规表单。 Mdi表单是启动时的



两个FormClosing事件都包含一个控制台写行语句。


当我单击X退出应用程序我只看到Mdi

FormClosing事件的输出。


没有来自常规表单。


这真的很简单,生成解决方案可能更容易

然后下载它。

但是我可以上传的地方所以你们有些专家可能会发表评论 - 我不想附上它。


我想这种行为可能是设计但似乎不太可能。


当他们被依赖时,没有得到关闭和关闭事件非常重要。



学术" < ac ************ @ a-znet.com写了留言

新闻:%2 *************** *@TK2MSFTNGP02.phx.gbl ...


>>我有一个MDI表格,有时是儿童表格,有时表格不是 br />
如果我关闭应用程序,孩子会关闭并关闭事件发生
接着是接收事件的Mdi表单..

但是也开放的常规表单不接受该事件。无论是否打开子窗体,这都是正确的。

MDI窗体始终处于打开状态并始终可以获取事件。

FormClosing的工作方式相同。 br />
似乎确实如果有一个MDI表单,其他非子表单
不会收到这些事件。

这是正确的吗?


谢谢




Academic Hi,


我假设应用程序有一个Forms集合。


如果你关闭MDI,那么,如果你的意图真的要结束整个

应用程序,循环,For Each,通过Forms集合并单独关闭每个

,除了MDI父级。


这应该可以解决你的问题,虽然我没有在VB.NET中尝试过。


在哲学层面上,你可能会重新考虑为什么你必须有非MDI
儿童形式漂浮在周围。那是 - 除非它们是模态形式。


Garry

" RobinS" < Ro **** @ NoSpam.yah.nonewrote in message

news:E5 ************************ ******@comcast.com。 ..


>

当你关闭
关闭时,为什么非MDI子表格会被关闭MDI表格?它不是MDI表格的孩子,

并且据他所知,它与MDI表格无关。

。关闭MDI表单将关闭

子项(但直到MDI表单关闭之后)

因为它们是相关的。


如果要关闭非MDI子窗体,

则必须在FormClosed

或关闭的MDI窗体的FormClosing事件中放置一些内容。 />
具体来说。


如果您希望在正常

表单关闭时关闭MDI表单,反之亦然适用。


Robin S.

------------------------- ---------


"学术" < ac ************ @ a-znet.comwrote in message

news:OU ************** @ TK2MSFTNGP03 .phx.gbl ...


>>我生成了一个只有MDI表单和非MDI的简单解决方案
非MdiChild表单。

我在Mdi表单的Load事件中打开常规表单。 Mdi表单是启动。

两个FormClosing事件都包含一个控制台写行语句。

当我单击X退出应用程序时,我只看到输出来自Mdi
FormClosing活动。

没有常规形式。

它真的很简单,生成解决方案可能更容易然后下载它。
但是我可以上传它的某个地方,所以有些专家可能会评论 - 我不想附上它。

我想这种行为可能是设计上的,但似乎不太可能。

当它们被依赖时,没有得到关闭和关闭事件是非常重要的。

"学术" < ac ************ @ a-znet.comwrote in message
新闻:%2 **************** @ TK2MSFTNGP02。 phx.gbl ...


>>>我有一个MDI表格,有时是儿童表格,有时表格是
既不是

如果我关闭应用程序,孩子将关闭并关闭事件发生
接着是接收事件的Mdi表单..

但是也开放的常规表单不会收到那个事件。无论是否打开子窗体,这都是正确的。

MDI窗体始终处于打开状态并始终可以获取事件。

FormClosing的工作方式相同。 br />
似乎确实如果有一个MDI表单,其他非子表单
不会收到这些事件。

这是正确的吗?


谢谢




I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens followed
by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This is
true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms do
not receive the events.

Is that correct???


Thanks

解决方案

I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form is
the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It''s really so simple that it might be easier to generate the solution then
to download it.
But is the someplace I can upload it so some of you experts might comment -
I''d hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...

>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms do
not receive the events.

Is that correct???


Thanks




Why would the non-MDI-child form be closed when you
close the MDI form? It''s not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...

>I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form is
the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It''s really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I''d hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...

>>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks




Academic Hi,

I assume that there is a Forms collection for the application.

If you close the MDI, then, if your intention is truly to end the whole
application, loop, For Each, thru the Forms collection and close each one
individually except the MDI parent.

That should solve your problem although I haven''t tried it in VB.NET.

On a philosophical level, you might reconsider why you have to have non-MDI
child forms floating around. That is - unless they are modal forms.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.com. ..

>
Why would the non-MDI-child form be closed when you
close the MDI form? It''s not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...

>>I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form
is the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It''s really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I''d hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...

>>>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks





这篇关于MDI获取FormClosing但非子表单也打开。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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