winforms 启用调整Windows窗体大小

xxls0lw8  于 2023-06-06  发布在  Windows
关注(0)|答案(2)|浏览(230)

如何通过单击窗体边框来调整窗体的大小?我甚至将FormBorderStyle设置为sizable。我错过了什么?
下面是表单的属性:

Designer.cs窗体部件:

//
        // Form1
        //
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
        this.ClientSize = new System.Drawing.Size(750, 378);
        this.Controls.Add(this.rtxt_inactiveprograms);
        this.Controls.Add(this.lbl_time);
        this.Controls.Add(this.lsv_runningapps);
        this.Controls.Add(this.btn_start);
        this.Controls.Add(this.label3);
        this.Controls.Add(this.textBox2);
        this.Controls.Add(this.lst_runningprocess);
        this.Controls.Add(this.label2);
        this.Controls.Add(this.label1);
        this.Controls.Add(this.txt_pcname);
        this.Controls.Add(this.btn_ping);
        this.Name = "Form1";
        this.Text = "Form1";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.ResumeLayout(false);
        this.PerformLayout();
kxkpmulp

kxkpmulp1#

这里的大小调整问题是,您只需要将AutoSizeModeGrowAndShrink更改为GrowOnly
但是在这里调整大小不会影响表单的内容,也不会根据您的需要调整分辨率。

ovfsdjhp

ovfsdjhp2#

FormBorderStyle设置为Sizable

相关问题