CPublicParameters.P_RedineControlLocationAndSize(this, floScreenProportion);
/// <summary>
/// 按照屏幕尺寸自適應(yīng)空間大小和位置。floScreenProportion為:屏幕尺寸/當(dāng)前設(shè)計尺寸
/// 比如當(dāng)前設(shè)計尺寸為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);
}
}