C# Cascading forms without mdi parent?

2019-07-16 02:38发布

I have been working on a project in C#, a portion of it requires multiple instances of a window to open. Is there any easy way to cascade the instances of the form? I'm assuming I'd have to deal with the math required manually. I just cannot wrap my head around it, any comments or suggestions would be greatly appreciated.

标签: c# cascade
1条回答
Rolldiameter
2楼-- · 2019-07-16 03:10

If I understand you correctly, you want the forms to appear on screen in a cascade effect:

Cascade

If so, when using WinForms you can do this by ensuring that the StartPosition property of each form is set to FormStartPosition.WindowsDefaultLocation (which it is by default).

If you are using WPF, you need to set the WindowStartupLocation property to WindowStartupLocation.Manual in a similar manner and not set a specific location for the window.

This leaves Windows to position the form when it displays, which it does by using the cascading effect shown in the picture.

查看更多
登录 后发表回答