【问题标题】:How to Fix Windows Forms Screen Size Problem如何修复 Windows 窗体屏幕大小问题
【发布时间】:2019-10-29 17:40:40
【问题描述】:

我创建了一个 Windows 窗体应用程序。这是表单设计器窗口中的样子。

在属性窗口中,我有

在属性窗口中,我将表单的大小设置为 (1356, 749)。但是,当我运行我的程序时,表单会调整大小。

以下是我在designer.cs 文件中的表单代码。我将长度和宽度设置为 2,当我运行程序时,窗口的大小与上图相同,而不是调整到我设置的非常小的值。当我将长度和宽度设置为两个时,表单设计器窗口中的屏幕尺寸发生了变化,但在我运行程序时却没有。我必须有其他因素在运行时控制表单的大小,但无法确定该属性的位置。

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);

【问题讨论】:

  • 只是一个猜测,但我敢打赌它与 AutoScaleMode 有关。请参阅this 帖子。

标签: c# user-interface windows-forms-designer


【解决方案1】:

我建议单击第一个屏幕截图顶部的“以 100% 缩放比例重新启动 Visual Studio”按钮。

【讨论】:

    猜你喜欢
    • 2011-10-04
    • 2019-11-20
    • 1970-01-01
    • 2012-12-28
    • 1970-01-01
    • 1970-01-01
    • 2011-03-10
    • 2017-10-29
    • 2011-06-07
    相关资源
    最近更新 更多