【发布时间】:2018-11-22 16:40:39
【问题描述】:
我创建了一个 .NET Framework 4.0 winforms 项目并添加了一个“选项卡”,如下图所示:
在视图设计器中,两个选项卡(配置文件和功能)看起来都适合矩形窗口,但是当我运行程序时,“配置文件”选项卡看起来相同,但“功能”选项卡突然不再适合矩形窗口看起来像这样:
我不想让用户选择放大窗口。
我想知道为什么它看起来适合矩形窗口,但当我运行应用程序时,它却不适合。
这是 MainForm 中的“功能”选项卡:
this.TabPage2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.TabPage2.Controls.Add(this.listBoxShowFriendsBirthday);
this.TabPage2.Controls.Add(this.buttonShowFriendsBirthday);
this.TabPage2.Controls.Add(this.label1);
this.TabPage2.Controls.Add(this.monthCalendar1);
this.TabPage2.Controls.Add(this.postTextBox);
this.TabPage2.Controls.Add(this.pictureBoxEvent);
this.TabPage2.Controls.Add(this.listBoxFetchEvents);
this.TabPage2.Controls.Add(this.buttonFetchEvents);
this.TabPage2.Controls.Add(this.postButton);
this.TabPage2.Location = new System.Drawing.Point(8, 39);
this.TabPage2.Name = "tabPage2";
this.TabPage2.Padding = new System.Windows.Forms.Padding(3);
this.TabPage2.Size = new System.Drawing.Size(1976, 806);
this.TabPage2.TabIndex = 1;
this.TabPage2.Text = "Features";
this.TabPage2.UseVisualStyleBackColor = true;
【问题讨论】:
-
您的应用程序是否支持 DPI?我认为不是。在这里阅读:How to configure an app to run correctly on a machine with a high DPI setting。 Some notes I've written:(正在更新)。