System.Windows.Forms.Form.ApplyAutoScaling C# (CSharp) Method

ApplyAutoScaling() private method

private ApplyAutoScaling ( ) : void
return void
		protected void ApplyAutoScaling()
		{
			SizeF current_size_f = GetAutoScaleSize (Font);
			Size current_size = new Size ((int)Math.Round (current_size_f.Width), (int)Math.Round (current_size_f.Height));
			float	dx;
			float	dy;

			if (current_size == autoscale_base_size)
				return;

			if (Environment.GetEnvironmentVariable ("MONO_MWF_SCALING") == "disable"){
				return;
			}
			
			//
			// I tried applying the Fudge height factor from:
			// http://blogs.msdn.com/mharsh/archive/2004/01/25/62621.aspx
			// but it makes things larger without looking better.
			//
			if (current_size.Width != AutoScaleBaseSize.Width) {
				dx = (float)current_size.Width / AutoScaleBaseSize.Width + 0.08f;
			} else {
				dx = 1;
			}

			if (current_size.Height != AutoScaleBaseSize.Height) {
				dy = (float)current_size.Height / AutoScaleBaseSize.Height + 0.08f;
			} else {
				dy = 1;
			}

			Scale (dx, dy);
			
			AutoScaleBaseSize = current_size;
		}
Form