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);
}
}