CPublicParameters.P_RedineControlLocationAndSize(this, floScreenProportion);
/// <summary>
/// 按照屏幕尺寸自適應空間大小和位置。floScreenProportion為:屏幕尺寸/當前設計尺寸
/// 比如當前設計尺寸為240,Screen.PrimaryScreen.Bounds.Width為獲取的實際屏幕尺寸
/// floScreenProportion = (float)Screen.PrimaryScreen.Bounds.Width / (float)240.0;
/// </summary>
/// <param name="parent"></param>
/// <param name="floScreenProportion"></param>
public static void P_RedineControlLocationAndSize(Control parent, float floScreenProportion)
{
foreach (Control control in parent.Controls)//遍歷Form上的所有控件
{
control.Width = (int)(floScreenProportion * control.Width);
control.Location = new Point((int)(floScreenProportion * (float)control.Location.X), control.Location.Y);
if (control.Controls.Count > 0)
{
P_RedineControlLocationAndSize(control,floScreenProportion);
}
}