C#winform中根据窗口分辨率大小,自动调整控件位置和大小的方法,详细点的,小弟初学、在线等?
2个回答
展开全部
哥,你真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分就值这么多了
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分就值这么多了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询