C# Winforms窗口在运行时的大小不同
目前我正在开发一个小型winforms应用程序。但我对尺寸有问题。我在设计器中设置了一个大小,如果大小正确并且正确,我还检查了初始化组件。但是当我运行程序时,它的大小比设计器中的小。以下是一些截图: 在设计器中: 在运行时: 初始化组件方法时的我的代码:C# Winforms窗口在运行时的大小不同,c#,winforms,C#,Winforms,目前我正在开发一个小型winforms应用程序。但我对尺寸有问题。我在设计器中设置了一个大小,如果大小正确并且正确,我还检查了初始化组件。但是当我运行程序时,它的大小比设计器中的小。以下是一些截图: 在设计器中: 在运行时: 初始化组件方法时的我的代码: this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); this.AutoScaleMode = System.Windows.Forms.AutoSca
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 1092);
this.Controls.Add(this.addressTextBox);
this.Controls.Add(this.addressLabel);
this.Controls.Add(this.descriptionRichTextBox);
this.Controls.Add(this.homepageTextBox);
this.Controls.Add(this.endDateTextBox);
this.Controls.Add(this.startDateTextBox);
this.Controls.Add(this.locationTextBox);
this.Controls.Add(this.homepageLabel);
this.Controls.Add(this.endDateLabel);
this.Controls.Add(this.startDateLabel);
this.Controls.Add(this.locationLabel);
this.Controls.Add(this.descriptionLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "EventDetailsWindow";
this.Text = "ParkManager - Veranstaltung";
this.ResumeLayout(false);
this.PerformLayout();
this.AutoScaleMode=System.Windows.Forms.AutoScaleMode.Font代码>更改为None
@ZoharPeled尝试过,但看起来很糟糕。有太多东西可以更改WinForms的大小,因此此框不够大,无法列出所有这些内容。每一件事情都有很好的理由,你最好让他们做他们的工作;不要试图让运行时输出看起来和您的开发机器上的完全一样,因为这几乎肯定会使其他人无法使用它