All, I have authoured a great number of WinForms, and this error is odd in that I have not come accross it before. This form is one of 30+ in this project and is the only one where the scaling is behaving oddly at differing screen resolutions and font scalings.
I am aware of the AutoScaleMode property and most of the time I have it set to Font to prevent precisely the error I have here. When I launch this form on my 1920×1080 display it is fine

but launching the form on a 1920×1200 display the group boxes seem to resize

this forces the buttons from the screen and causes general uglyness. I can also get this to occur on my 1980×1080 display if I change the default OS font from 125% to 100%.
The top group box is anchored (Left, Right, Top), the bottom group box is anchored (Left, Right, Top, Bottom). The form is set to and AutoScaleMode of Font. The other controls are not AutoSized.
What is the problem and how can I resolve it?
Thanks for your time.
Edit: The designer file is as follows.
namespace IPACost
{
partial class CreateNationalDbForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.customTreeViewSql = new IPACost.CustomTreeView();
this.panelBottom = new System.Windows.Forms.Panel();
this.buttonRefresh = new System.Windows.Forms.Button();
this.groupBoxBottom = new System.Windows.Forms.GroupBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.customRichTextBox1 = new IPACost.CustomRichTextBox();
this.labelInfo = new System.Windows.Forms.Label();
this.groupBoxTop = new System.Windows.Forms.GroupBox();
this.checkBoxInclSNAP = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.comboBoxUnits = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.textBoxIniSize = new System.Windows.Forms.TextBox();
this.labelName = new System.Windows.Forms.Label();
this.textBoxDbName = new System.Windows.Forms.TextBox();
this.buttonNoFilter = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonAppend = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panelBottom.SuspendLayout();
this.groupBoxBottom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBoxTop.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(2);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.customTreeViewSql);
this.splitContainer1.Panel1.Controls.Add(this.panelBottom);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.groupBoxBottom);
this.splitContainer1.Panel2.Controls.Add(this.groupBoxTop);
this.splitContainer1.Panel2.Controls.Add(this.buttonNoFilter);
this.splitContainer1.Panel2.Controls.Add(this.buttonCancel);
this.splitContainer1.Panel2.Controls.Add(this.buttonAppend);
this.splitContainer1.Size = new System.Drawing.Size(705, 357);
this.splitContainer1.SplitterDistance = 199;
this.splitContainer1.SplitterWidth = 6;
this.splitContainer1.TabIndex = 0;
//
// customTreeViewSql
//
this.customTreeViewSql.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.customTreeViewSql.Dock = System.Windows.Forms.DockStyle.Fill;
this.customTreeViewSql.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText;
this.customTreeViewSql.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.customTreeViewSql.HotTrackFont = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.customTreeViewSql.HotTracking = true;
this.customTreeViewSql.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
this.customTreeViewSql.Location = new System.Drawing.Point(0, 0);
this.customTreeViewSql.Margin = new System.Windows.Forms.Padding(2);
this.customTreeViewSql.Name = "customTreeViewSql";
this.customTreeViewSql.ShowNodeToolTips = true;
this.customTreeViewSql.Size = new System.Drawing.Size(199, 320);
this.customTreeViewSql.TabIndex = 7;
this.customTreeViewSql.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.customTreeViewSql_NodeMouseClick);
//
// panelBottom
//
this.panelBottom.Controls.Add(this.buttonRefresh);
this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelBottom.Location = new System.Drawing.Point(0, 320);
this.panelBottom.Margin = new System.Windows.Forms.Padding(2);
this.panelBottom.Name = "panelBottom";
this.panelBottom.Size = new System.Drawing.Size(199, 37);
this.panelBottom.TabIndex = 7;
//
// buttonRefresh
//
this.buttonRefresh.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonRefresh.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.buttonRefresh.Location = new System.Drawing.Point(2, 2);
this.buttonRefresh.Margin = new System.Windows.Forms.Padding(2);
this.buttonRefresh.Name = "buttonRefresh";
this.buttonRefresh.Size = new System.Drawing.Size(195, 33);
this.buttonRefresh.TabIndex = 8;
this.buttonRefresh.Text = "Show Database Structure";
this.buttonRefresh.UseVisualStyleBackColor = true;
this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
//
// groupBoxBottom
//
this.groupBoxBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxBottom.Controls.Add(this.pictureBox1);
this.groupBoxBottom.Controls.Add(this.customRichTextBox1);
this.groupBoxBottom.Controls.Add(this.labelInfo);
this.groupBoxBottom.Location = new System.Drawing.Point(4, 120);
this.groupBoxBottom.Name = "groupBoxBottom";
this.groupBoxBottom.Size = new System.Drawing.Size(480, 188);
this.groupBoxBottom.TabIndex = 12;
this.groupBoxBottom.TabStop = false;
this.groupBoxBottom.Text = "Additional SQL Filtering [WHERE:]";
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.pictureBox1.Image = global::IPACost.Properties.Resources.Info;
this.pictureBox1.Location = new System.Drawing.Point(5, 122);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(38, 38);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
//
// customRichTextBox1
//
this.customRichTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.customRichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.customRichTextBox1.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.customRichTextBox1.Location = new System.Drawing.Point(5, 20);
this.customRichTextBox1.Margin = new System.Windows.Forms.Padding(2);
this.customRichTextBox1.Name = "customRichTextBox1";
this.customRichTextBox1.Size = new System.Drawing.Size(472, 86);
this.customRichTextBox1.TabIndex = 3;
this.customRichTextBox1.Text = "e.g. [B1A].[ProdType] IN (\'AC\', \'NB\', \'AE\')";
//
// labelInfo
//
this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelInfo.Location = new System.Drawing.Point(47, 108);
this.labelInfo.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.labelInfo.Name = "labelInfo";
this.labelInfo.Size = new System.Drawing.Size(428, 77);
this.labelInfo.TabIndex = 1;
this.labelInfo.Text = "This filters the create database result sets for the National Databases. The filt" +
"ering SQL should only contain a valid WHERE clause on the core data table [B1A]." +
" The \'WHERE\' Keyword is not required.\r\n";
//
// groupBoxTop
//
this.groupBoxTop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxTop.Controls.Add(this.checkBoxInclSNAP);
this.groupBoxTop.Controls.Add(this.label2);
this.groupBoxTop.Controls.Add(this.comboBoxUnits);
this.groupBoxTop.Controls.Add(this.label1);
this.groupBoxTop.Controls.Add(this.textBoxIniSize);
this.groupBoxTop.Controls.Add(this.labelName);
this.groupBoxTop.Controls.Add(this.textBoxDbName);
this.groupBoxTop.Location = new System.Drawing.Point(2, 10);
this.groupBoxTop.Margin = new System.Windows.Forms.Padding(2);
this.groupBoxTop.Name = "groupBoxTop";
this.groupBoxTop.Padding = new System.Windows.Forms.Padding(2);
this.groupBoxTop.Size = new System.Drawing.Size(479, 105);
this.groupBoxTop.TabIndex = 11;
this.groupBoxTop.TabStop = false;
this.groupBoxTop.Text = "National Database Details:";
//
// checkBoxInclSNAP
//
this.checkBoxInclSNAP.AutoSize = true;
this.checkBoxInclSNAP.Location = new System.Drawing.Point(155, 76);
this.checkBoxInclSNAP.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxInclSNAP.Name = "checkBoxInclSNAP";
this.checkBoxInclSNAP.Size = new System.Drawing.Size(148, 21);
this.checkBoxInclSNAP.TabIndex = 14;
this.checkBoxInclSNAP.Text = "Include SNAP data";
this.checkBoxInclSNAP.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(290, 51);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(160, 17);
this.label2.TabIndex = 13;
this.label2.Text = "Default growth rate 20%";
//
// comboBoxUnits
//
this.comboBoxUnits.FormattingEnabled = true;
this.comboBoxUnits.Items.AddRange(new object[] {
"B",
"KB",
"MB",
"GB",
"TB",
"PB"});
this.comboBoxUnits.Location = new System.Drawing.Point(232, 48);
this.comboBoxUnits.Margin = new System.Windows.Forms.Padding(2);
this.comboBoxUnits.Name = "comboBoxUnits";
this.comboBoxUnits.Size = new System.Drawing.Size(53, 24);
this.comboBoxUnits.TabIndex = 12;
this.comboBoxUnits.Text = "MB";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 51);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(139, 17);
this.label1.TabIndex = 11;
this.label1.Text = "Estimated initial size:";
//
// textBoxIniSize
//
this.textBoxIniSize.Location = new System.Drawing.Point(155, 48);
this.textBoxIniSize.Margin = new System.Windows.Forms.Padding(2);
this.textBoxIniSize.Name = "textBoxIniSize";
this.textBoxIniSize.Size = new System.Drawing.Size(74, 22);
this.textBoxIniSize.TabIndex = 10;
this.textBoxIniSize.Text = "100";
this.textBoxIniSize.Leave += new System.EventHandler(this.textBoxIniSize_Leave);
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(39, 24);
this.labelName.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(112, 17);
this.labelName.TabIndex = 9;
this.labelName.Text = "Database name:";
//
// textBoxDbName
//
this.textBoxDbName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxDbName.Location = new System.Drawing.Point(155, 21);
this.textBoxDbName.Margin = new System.Windows.Forms.Padding(2);
this.textBoxDbName.Name = "textBoxDbName";
this.textBoxDbName.Size = new System.Drawing.Size(287, 22);
this.textBoxDbName.TabIndex = 1;
//
// buttonNoFilter
//
this.buttonNoFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonNoFilter.Location = new System.Drawing.Point(258, 313);
this.buttonNoFilter.Margin = new System.Windows.Forms.Padding(2);
this.buttonNoFilter.Name = "buttonNoFilter";
this.buttonNoFilter.Size = new System.Drawing.Size(104, 33);
this.buttonNoFilter.TabIndex = 5;
this.buttonNoFilter.Text = "Run No Filter";
this.buttonNoFilter.UseVisualStyleBackColor = true;
this.buttonNoFilter.Click += new System.EventHandler(this.buttonNoFilter_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.Location = new System.Drawing.Point(162, 313);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(2);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(92, 33);
this.buttonCancel.TabIndex = 4;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// buttonAppend
//
this.buttonAppend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAppend.Location = new System.Drawing.Point(366, 313);
this.buttonAppend.Margin = new System.Windows.Forms.Padding(2);
this.buttonAppend.Name = "buttonAppend";
this.buttonAppend.Size = new System.Drawing.Size(117, 33);
this.buttonAppend.TabIndex = 6;
this.buttonAppend.Text = "Run Use Filter";
this.buttonAppend.UseVisualStyleBackColor = true;
this.buttonAppend.Click += new System.EventHandler(this.buttonAppend_Click);
//
// CreateNationalDbForm
//
this.AcceptButton = this.buttonNoFilter;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(705, 357);
this.Controls.Add(this.splitContainer1);
this.Margin = new System.Windows.Forms.Padding(2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(523, 303);
this.Name = "CreateNationalDbForm";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Special Processes Options";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SpecialSqlForm_FormClosing);
this.Load += new System.EventHandler(this.SpecialSqlForm_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.panelBottom.ResumeLayout(false);
this.groupBoxBottom.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.groupBoxTop.ResumeLayout(false);
this.groupBoxTop.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private CustomTreeView customTreeViewSql;
private System.Windows.Forms.Panel panelBottom;
private System.Windows.Forms.Button buttonRefresh;
private System.Windows.Forms.Label labelInfo;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Button buttonAppend;
private CustomRichTextBox customRichTextBox1;
private System.Windows.Forms.Button buttonNoFilter;
private System.Windows.Forms.Label labelName;
private System.Windows.Forms.TextBox textBoxDbName;
private System.Windows.Forms.GroupBox groupBoxTop;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxIniSize;
private System.Windows.Forms.ComboBox comboBoxUnits;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox checkBoxInclSNAP;
private System.Windows.Forms.GroupBox groupBoxBottom;
}
}
I could not establish the exact cause of this problem. However, I did come up with a solution after about a million itterations of form and control settings. It was to insert another
Paneldocked asFillinsidePanel2of theSplitContainercontrol. This seemingly now prevents any odd scaling issues presumably being inherited from the underlyingSplitContainer.It’s not an answer to why this was going on, but it is a fix and hope hope it can helps someone else.
Thanks for your time.