Isaiah Dicristoforo
Isaiah Dicristoforo

Reputation: 169

How to Fix Windows Forms Screen Size Problem

I have a windows forms application created. Here is what it looks like in the form designer window.

enter image description here In the property window, I have

In the property window, I have the form's size set to (1356, 749). However, when I run my program, the form resizes.
enter image description here

Below is my code for the form in the designer.cs file. I set length and width to 2, and when I ran my program the window stayed the same size as the image shown above, instead of resizing to the insanely small values I set it to. When I set the length and width to two, the screen size changed in the form designer window but not when I ran the program. I must have some other factor controlling the size of my form at runtime but cannot figure out where this property is located.

this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(2,2);
        this.Controls.Add(this.panel_UserInput);
        this.Controls.Add(this.panel_ButtonPanel);
        this.Controls.Add(this.listView_PrimeCheckResults);
        this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
        this.Name = "form_MainForm";
        this.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds;
        this.Text = "Form1";
        this.Load += new System.EventHandler(this.Form_MainForm_Load);
        this.panel_ButtonPanel.ResumeLayout(false);
        this.panel_UserInput.ResumeLayout(false);
        this.panel_UserInput.PerformLayout();
        this.ResumeLayout(false);

Upvotes: 1

Views: 1239

Answers (1)

Joswin John
Joswin John

Reputation: 50

I suggest clicking the, “restart visual studio with 100% scaling” button at the top there on the first screenshot.

Upvotes: 0

Related Questions