我想了几个思路但自己不会实现,
1:获取我的窗口的父窗口(即桌面窗口)的所有其他窗口,然后一一设置值
2:捕捉windows底层的最大化消息,然后改变消息中的值
3:设置桌面屏幕工作区的大小
不晓得这些思路对不对,谁能给我说下正确的解决方法阿,我昨天起才开始学c#的,帮帮我这个可怜的c#菜鸟吧
1:获取我的窗口的父窗口(即桌面窗口)的所有其他窗口,然后一一设置值
2:捕捉windows底层的最大化消息,然后改变消息中的值
3:设置桌面屏幕工作区的大小
不晓得这些思路对不对,谁能给我说下正确的解决方法阿,我昨天起才开始学c#的,帮帮我这个可怜的c#菜鸟吧
,如果要做到“那些最大化的窗口的边缘紧贴着我的窗口的边缘”就比较难了,而且也不美观。
UINT uiAction,
UINT uiParam,
PVOID pvParam,
UINT fWinIni
);其中:uiAction = SPI_SETWORKAREA
pvParam = 一个RECT的指针,指示新的工作区矩形框
其他参数忽略。MSDN注释: Sets the size of the work area. The work area is the portion of the screen not obscured by the system taskbar or by application desktop toolbars. The pvParam parameter is a pointer to a RECT structure that specifies the new work area rectangle, expressed in virtual screen coordinates. In a system with multiple display monitors, the function sets the work area of the monitor that contains the specified rectangle.
using System.Runtime.InteropServices; [DllImport("User32.dll", CharSet=CharSet.Auto)]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref RECT param, uint fWinINI); [StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
} const int SPI_SETWORKAREA = 0x002F; void SetWorkintArea(int left, int top, int width, int height)
{
RECT rect = new RECT();
rect.left = left;
rect.top = top;
rect.right = left+width;
rect.bottom = top+height;
SystemParametersInfo(SPI_SETWORKAREA, 0, ref rect, 0);
} private void button1_Click(object sender, System.EventArgs e)
{
SetWorkintArea(200, 0, 524, 740);
}运行之后,你会看到窗口最大化后,限制在一定范围里了