表单大小显示不正确

时间:2018-06-26 01:54:49

标签: c# winforms

我开始构建一个使用大量屏幕的Winform应用程序。因此,我将一个表单(大小为2477,1402)放在Tab控件(位置23,25,大小为1883,1244)内

但是,在运行程序时,选项卡的右边框太靠近表格了。实际上,无论您放大窗体多少,窗体大小都将保持不变,并且如果选项卡控件被放大,则窗体将隐藏选项卡控件空间的一部分。

该问题如何解决?


控件的设计者代码

private void InitializeComponent()
        {
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.tabPage3 = new System.Windows.Forms.TabPage();
            this.panel1 = new System.Windows.Forms.Panel();
            this.btn60_1 = new System.Windows.Forms.Button();
            this.btn60_2 = new System.Windows.Forms.Button();
            this.btn60_3 = new System.Windows.Forms.Button();
            this.btn60_4 = new System.Windows.Forms.Button();
            this.btn60_5 = new System.Windows.Forms.Button();
            this.btn60_6 = new System.Windows.Forms.Button();
            this.btn60_7 = new System.Windows.Forms.Button();
            this.btn60_8 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
            // 
            // tabControl1
            // 
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Controls.Add(this.tabPage3);
            this.tabControl1.Location = new System.Drawing.Point(12, 12);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(1883, 1244);
            this.tabControl1.TabIndex = 0;
            // 
            // tabPage1
            // 
            this.tabPage1.Controls.Add(this.panel1);
            this.tabPage1.Location = new System.Drawing.Point(4, 28);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage1.Size = new System.Drawing.Size(1875, 1212);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "tab1";
            this.tabPage1.UseVisualStyleBackColor = true;
            // 
            // tabPage2
            // 
            this.tabPage2.Location = new System.Drawing.Point(4, 28);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage2.Size = new System.Drawing.Size(2038, 1140);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "tab2";
            this.tabPage2.UseVisualStyleBackColor = true;
            // 
            // tabPage3
            // 
            this.tabPage3.Location = new System.Drawing.Point(4, 28);
            this.tabPage3.Name = "tabPage3";
            this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage3.Size = new System.Drawing.Size(1875, 1212);
            this.tabPage3.TabIndex = 2;
            this.tabPage3.Text = "tab3";
            this.tabPage3.UseVisualStyleBackColor = true;
            // 
            // panel1
            // 
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.panel1.Controls.Add(this.button1);
            this.panel1.Controls.Add(this.btn60_8);
            this.panel1.Controls.Add(this.btn60_7);
            this.panel1.Controls.Add(this.btn60_6);
            this.panel1.Controls.Add(this.btn60_5);
            this.panel1.Controls.Add(this.btn60_4);
            this.panel1.Controls.Add(this.btn60_3);
            this.panel1.Controls.Add(this.btn60_2);
            this.panel1.Controls.Add(this.btn60_1);
            this.panel1.Location = new System.Drawing.Point(22, 19);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(522, 466);
            this.panel1.TabIndex = 0;

            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(2455, 1346);
            this.Controls.Add(this.tabControl1);
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "My program";
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.panel1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

1 个答案:

答案 0 :(得分:0)

这个答案可以帮助您吗?

        private void Form1_Load(object sender, EventArgs e)
    {
        this.AutoScroll = true;
    }