哥,你真kou,详细点才给10分
Screen.PrimaryScreen.WorkingArea
或者
const int SPI_GETWORKAREA = 0x30;
[DllImport("user32.dll")]
static extern bool SystemParametersInfoA(int uiAction, int uiParam, ref RECT pvParam, uint fWinlni);
public static Rect GetWorkArea()
{
RECT rWorkArea = new RECT();
SystemParametersInfoA(SPI_GETWORKAREA, Marshal.SizeOf(rWorkArea), ref rWorkArea, 0);
return new Rect(rWorkArea.Left, rWorkArea.Top, rWorkArea.Right - rWorkArea.Left, rWorkArea.Bottom - rWorkArea.Top);
}
都是获取实际像素滴,10分就值这么多了
根据窗口大小的改变,把控件的dock或者anchor的属性改下就行了