我正在为家庭用户开发一个应用程序。此应用程序涉及完全替换Windows资源管理器以用于自定义应用程序。
我想模仿任务栏的行为。例如,单击记事本中的最大化按钮时,它不会与任务栏重叠。
我已经尝试将api用于AppBar但是,当Windows资源管理器未运行且其他窗口与我的任务栏重叠时,AppBar api不起作用。
知道我怎么能这样做吗?如果我可以限制最大化窗口的大小,那么对我有帮助。问题是其他应用程序并不总是由我编写。
答案 0 :(得分:1)
我找到了一个使用win32 api SystemParametersInfo的例子。 通过这种方式,我可以定义其他应用程序适合的区域,并为其表单留出空间,即使其他应用程序已最大化。
public static void MakeNewDesktopArea()
{
// Save current Working Area size
m_rcOldDesktopRect.left = SystemInformation.WorkingArea.Left;
m_rcOldDesktopRect.top = SystemInformation.WorkingArea.Top;
m_rcOldDesktopRect.right = SystemInformation.WorkingArea.Right;
m_rcOldDesktopRect.bottom = SystemInformation.WorkingArea.Bottom;
// Make a new Workspace
WinAPI.RECT rc;
rc.left = SystemInformation.VirtualScreen.Left + 150;
rc.top = SystemInformation.VirtualScreen.Top; // We reserve the 24 pixels on top for our taskbar
rc.right = SystemInformation.VirtualScreen.Right;
rc.bottom = SystemInformation.VirtualScreen.Bottom - 101;
WinAPI.SystemParametersInfo((int)WinAPI.SPI.SPI_SETWORKAREA, 0, ref rc, 0);
}