C# Cascading forms without mdi parent?

柔情痞子 提交于 2019-12-11 00:13:47

问题


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.


回答1:


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

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.



来源:https://stackoverflow.com/questions/5560081/c-sharp-cascading-forms-without-mdi-parent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!