Float floScreenProportion = (float) Screen. PrimaryScreen. Bounds. Width/(float) 240.0; CPublicParameters. P_RedineControlLocationAndSize (this, floScreenProportion );
/// <Summary> /// adjust the space size and position according to the screen size. FloScreenProportion is: Screen size/current design size // For example, the current design size is 240, Screen. primaryScreen. bounds. width is the actual Screen size obtained. // 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) // traverses all Controls on THE 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 );}}}
This article is from the "Snow volcano" blog, please be sure to keep this source http://zw20045.blog.51cto.com/1135644/1290063