级联非MDI窗口形式 [英] Cascading Non-MDI windows form

查看:91
本文介绍了级联非MDI窗口形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows窗体,它打开了其他一些窗口的多个实例,在规范化模式下说
Form1 。这是非mdi应用程序。现在我想级联
Form1 的窗口。

I have one windows form which is opening multiple instances of some other windows form say Form1 in normalized mode. This is Non-mdi application. Now I want to Cascade the windows of Form1.

有没有办法级联非MDI窗体?

Is there a way to cascade non-MDI windows form?

谢谢,

Hrushikesh

Hrushikesh

Hrushikesh Pande

Hrushikesh Pande

推荐答案


我有一个窗口表单,它打开了一些其他窗体的多个实例,比如规格化模式下的
Form1 。这是非mdi应用程序。现在我想级联
Form1 的窗口。

I have one windows form which is opening multiple instances of some other windows form say Form1 in normalized mode. This is Non-mdi application. Now I want to Cascade the windows of Form1.

只需使用 按顺序设置每个表单的位置;递增位置的x,y值。

Just set the location of each form in sequence using incrementing x,y values for the Location.

如果您遇到困难,那么可能的原因是您没有维护可用于引用这些窗口的变量。  你将如何做到这一点取决于它们是如何被创建的。如果它们都是从
Form1打开的,那么你可以创建一个集合(例如,List(Of T))并添加到列表中已打开。  跟踪它们的关闭有点复杂;这需要每个表单中的代码更新表单上保存的列表
1.  此外,您将必须决定如何调用级联命令 - 如果它只来自表单1那么这很简单 - 如果它来自任何形式,那么它会更复杂。

If you are having a difficulty with that then the likely reason is that you have not maintained variables that you can use to refer to these windows.  How you would do that depends on how they are being created. If they are all being opened from Form1 then you can create a collection (eg, a List(Of T)) and add to the list as they are opened.   To keep track of them being closed is a little more complex; this requires code in each form to update the list that is being maintained on form 1.   Also, you will have to decide how the command to cascade is called - if it's only from Form 1 then that's simple - if it is from any form then it's a bit more complex.

所以这一切都取决于你的应用程序是如何构建的,但实质上你只是维护一个已排序的集合,当你想要对表单进行级联时,你会根据需要设置Location属性。

So it all depends on how your application is constructed, but essentially you just maintain a sorted collection and when you want to cascade the forms you iterate over the collection setting the Location property as required.


这篇关于级联非MDI窗口形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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