title: Windows form not scaling height when display is scaled 150%
body: <p>I've got this down to a very simple repro, and cannot figure out what is going wrong with this form.  When run at 96 DPI / 100% scale it appears fine:</p>
  
  <p><a href="https://i.stack.imgur.com/UHyEg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UHyEg.png" alt="enter image description here"></a></p>
  
  <p>But when run at 144 DPI / 150% scale (or even 96 DPI / 150% scale), everything scales except the form height:</p>
  
  <p><a href="https://i.stack.imgur.com/N4cXP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N4cXP.png" alt="enter image description here"></a></p>
  
  <p>Originally I thought this was a DPI issue, but after verifying that it repros at 96 DPI, I'm not sure what's going on.</p>
  
  <p>There is nothing special going on with the dialog or control, other than specifically setting the font of the dialog, and setting the AutoScaleMode to DPI.  The form lives inside an assembly that is loaded automatically by the app.</p>
  
  <p>I'm using .NET 4.7.2 and Windows 10.</p>
  
  <p>Here's the form code:</p>
  
  <pre><code>using System;
  using System.Net;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace FormTestLib
  {
      partial class ValidatingSplash : Form
      {
          public ValidatingSplash()
          {
              InitializeComponent();
          }
  
          protected override void OnLoad(EventArgs e)
          {
              base.OnLoad(e);
              this.CenterToParent();
          }
      }
  }
  </code></pre>
  
  <p>Here's the designer file:</p>
  
  <pre><code>namespace FormTestLib
  {
      public partial class ValidatingSplash
      {
          /// &lt;summary&gt;
          /// Required designer variable.
          /// &lt;/summary&gt;
          private System.ComponentModel.IContainer components = null;
  
          /// &lt;summary&gt;
          /// Clean up any resources being used.
          /// &lt;/summary&gt;
          /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
          protected override void Dispose(bool disposing)
          {
              if (disposing &amp;&amp; (components != null))
              {
                  components.Dispose();
              }
              base.Dispose(disposing);
          }
  
          #region Windows Form Designer generated code
  
          /// &lt;summary&gt;
          /// Required method for Designer support - do not modify
          /// the contents of this method with the code editor.
          /// &lt;/summary&gt;
          private void InitializeComponent()
          {
              System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ValidatingSplash));
              this.lblValidating = new System.Windows.Forms.Label();
              this.SuspendLayout();
              // 
              // lblValidating
              // 
              this.lblValidating.Anchor = System.Windows.Forms.AnchorStyles.None;
              this.lblValidating.AutoSize = true;
              this.lblValidating.Location = new System.Drawing.Point(58, 45);
              this.lblValidating.Name = "lblValidating";
              this.lblValidating.Size = new System.Drawing.Size(166, 13);
              this.lblValidating.TabIndex = 7;
              this.lblValidating.Text = "Validating cached credentials...";
              // 
              // ValidatingSplash
              // 
              this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
              this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
              this.ClientSize = new System.Drawing.Size(274, 104);
              this.ControlBox = false;
              this.Controls.Add(this.lblValidating);
              this.Font = new System.Drawing.Font("Segoe UI", 8.25F);
              this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
              this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
              this.MaximizeBox = false;
              this.MinimizeBox = false;
              this.Name = "ValidatingSplash";
              this.Text = "Validating Credentials";
              this.ResumeLayout(false);
              this.PerformLayout();
  
          }
  
          #endregion
          private System.Windows.Forms.Label lblValidating;
      }
  }
  </code></pre>
  
  <p>In the app.config I'm setting DpiAwareness according to the docs:</p>
  
  <pre><code>&lt;System.Windows.Forms.ApplicationConfigurationSection&gt;
    &lt;add key="DpiAwareness" value="PerMonitorV2"/&gt;
  &lt;/System.Windows.Forms.ApplicationConfigurationSection&gt;
  </code></pre>
  
  <p>And in the manifest I'm setting the compatibility:</p>
  
  <pre><code>&lt;compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"&gt;
    &lt;application&gt;
      &lt;!-- Windows 10 compatibility --&gt;
      &lt;supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /&gt;
    &lt;/application&gt;
  &lt;/compatibility&gt;
  </code></pre>
  
  <p>All this according to the instructions for high DPI support <a href="https://docs.microsoft.com/en-us/dotnet/framework/winforms/high-dpi-support-in-windows-forms" rel="nofollow noreferrer">here</a>.</p>
  
  <p>The application code simply shows the dialog:</p>
  
  <pre><code>namespace TestApp
  {
      static class Program
      {
          /// &lt;summary&gt;
          /// The main entry point for the application.
          /// &lt;/summary&gt;
          [STAThread]
          static void Main()
          {
              // set the visual styles
              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(true);
  
              ValidatingSplash Splash = new ValidatingSplash();
              Splash.ShowDialog();
          }
      }
  }
  </code></pre>
  
  <p>Can anyone see what I might be doing wrong, or what I'm missing?  </p>
  
  <p>Thanks in advance!</p>