如何移动/排列所有桌面窗口?(即"Show Windows Stacked" [英] How can I move/arrange all desktop windows? (i.e. "Show Windows Stacked"
问题描述
是否可以在 C#(使用 Win32 API 或其他)中以编程方式排列所有打开的应用程序窗口?
Is it possible in C# (using Win32 API, or whatever) to programmatically arrange all open application windows?
例如,在 Windows 7 中,如果您右键单击任务栏,则会出现一个名为显示堆叠的窗口"和并排显示窗口"的选项.
For example, in Windows 7 if you right-click the taskbar there is an option called "Show windows stacked" and "Show windows side-by-side".
这正是我试图通过代码复制的内容.
That is exactly what I'm trying to replicate by code.
为了进一步解释,我想遍历所有打开的应用程序,显示主窗口,然后将其与所有其他打开的应用程序窗口一起排列在桌面/显示器上.
To explain even further, I want to iterate through all open applications, display the main window, and then arrange it on the desktop/monitor along with all other open application windows.
推荐答案
您正在寻找的功能是 TileWindows
.一些例子:
The function you're looking for is TileWindows
. Some examples:
TileWindows(NULL, MDITILE_HORIZONTAL, NULL, 0, NULL); // "Show windows stacked"
TileWindows(NULL, MDITILE_VERTICAL, NULL, 0, NULL); // "Show windows side-by-side"
如果你想级联窗口,你可以使用 <代码>CascadeWindows:
If you wanted to cascade the windows, you could use CascadeWindows
:
CascadeWindows(NULL, MDITILE_ZORDER, NULL, 0, NULL); // "Cascade windows"
这篇关于如何移动/排列所有桌面窗口?(即&quot;Show Windows Stacked&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!