Winforms窗口大小在运行时不同

时间:2018-05-06 16:01:58

标签: c# winforms

目前我正在开发一个小winforms应用程序。但我对尺寸有问题。我在设计师处设置了一个大小,如果大小正确,我也检查了初始化组件。但是当我运行程序时,其大小比设计者小。这里有一些截图:

在设计师中:

在运行时: enter image description here

初始化组件方法的代码:

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

0 个答案:

没有答案