的WinForms DataGridView的调整问题 [英] Winforms DataGridView resizing issue

查看:181
本文介绍了的WinForms DataGridView的调整问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是100%肯定,我应该如何字这个问题,但我会尽我所能。

我有一个PointCtrlForm有内部一个TableLayoutPanel一个DataGridView。在DataGridView停靠表的填写。 PointCtrlForm停靠在另一个窗口设置的MdiParent与dockstyle属性设置为填充。

调整主窗口中正确地调整其大小PointCtrlForm,然后应该调整的DataGridView也是如此。好吧,至少大小调整的半壁江山工作正常。扩大主窗口也扩大了datagridview的,这是我所期待的,但如果我缩在主窗口到某一点,在DataGridView停止萎缩,隐藏列,而不显示滚动条。

我已经检查了所有的列没有冻结的财产启用,检查,无论是datagridview的和子窗口正常停靠,并检查了滚动条属性设置为两个。

编辑:AutoSizeColumnsMode也填补

我会在这里发表的Designer.cs的内容。我倒是AP preciate任何指导。

 命名空间DDCUI
{
    部分类PointCtrlForm
    {
        ///<总结>
        ///必需的设计变量。
        ///< /总结>
        私人System.ComponentModel.IContainer成分= NULL;

        ///<总结>
        ///清理所有正在使用的资源。
        ///< /总结>
        ///< PARAM NAME =处理>如此,如果管理资源应该处理;否则为false< /参数>
        保护覆盖无效的Dispose(BOOL处置)
        {
            如果(处置和放大器;&安培;!(成分= NULL))
            {
                components.Dispose();
            }
            base.Dispose(处置);
        }

        #region Windows窗体设计器生成的code

        ///<总结>
        ///设计器支持所需的方法 - 不要修改
        ///此方法的code编辑器的内容。
        ///< /总结>
        私人无效的Ini​​tializeComponent()
        {
            this.tableLayoutPanel1 =新System.Windows.Forms.TableLayoutPanel();
            this.CmbSubDevice =新System.Windows.Forms.ComboBox();
            this.BtnBack =新System.Windows.Forms.Button();
            this.CmbMainDevice =新System.Windows.Forms.ComboBox();
            this.dataGridView1 =新System.Windows.Forms.DataGridView();
            this.BtnRefresh =新System.Windows.Forms.Button();
            this.label1 =新System.Windows.Forms.Label();
            this.ID =新System.Windows.Forms.DataGridViewTextBoxColumn();
            this.PointName =新System.Windows.Forms.DataGridViewTextBoxColumn();
            THIS.VALUE =新System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Description =新System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DefaultValue =新System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ActiveString =新System.Windows.Forms.DataGridViewTextBoxColumn();
            this.InactiveString =新System.Windows.Forms.DataGridViewTextBoxColumn();
            this.AlarmCondition =新System.Windows.Forms.DataGridViewTextBoxColumn();
            this.tableLayoutPanel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1))BeginInit在()。
            this.SuspendLayout();
            //
            // tableLayoutPanel1
            //
            this.tableLayoutPanel1.ColumnCount = 6;
            this.tableLayoutPanel1.ColumnStyles.Add(新System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute,100F));
            this.tableLayoutPanel1.ColumnStyles.Add(新System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute,100F));
            this.tableLayoutPanel1.ColumnStyles.Add(新System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute,100F));
            this.tableLayoutPanel1.ColumnStyles.Add(新System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute,100F));
            this.tableLayoutPanel1.ColumnStyles.Add(新System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute,151F));
            this.tableLayoutPanel1.ColumnStyles.Add(新System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute,88F));
            this.tableLayoutPanel1.Controls.Add(this.CmbSubDevice,0,1);
            this.tableLayoutPanel1.Controls.Add(this.BtnBack,0,0);
            this.tableLayoutPanel1.Controls.Add(this.CmbMainDevice,0,1);
            this.tableLayoutPanel1.Controls.Add(this.dataGridView1,0,2);
            this.tableLayoutPanel1.Controls.Add(this.BtnRefresh,4,1);
            this.tableLayoutPanel1.Controls.Add(this.label1,5,1);
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location =新System.Drawing.Point(0,0);
            this.tableLayoutPanel1.Name =tableLayoutPanel1;
            this.tableLayoutPanel1.RowCount = 3;
            this.tableLayoutPanel1.RowStyles.Add(新System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent,67.02128F));
            this.tableLayoutPanel1.RowStyles.Add(新System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent,32.97872F));
            this.tableLayoutPanel1.RowStyles.Add(新System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute,368F));
            this.tableLayoutPanel1.RowStyles.Add(新System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute,20F));
            this.tableLayoutPanel1.Size =新System.Drawing.Size(639,467);
            this.tableLayoutPanel1.TabIndex = 0;
            //
            // CmbSubDevice
            //
            this.tableLayoutPanel1.SetColumnSpan(this.CmbSubDevice,2);
            this.CmbSubDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CmbSubDevice.Font =新System.Drawing.Font(굴림,12F);
            this.CmbSubDevice.FormattingEnabled = TRUE;
            this.CmbSubDevice.Location =新System.Drawing.Point(203,69);
            this.CmbSubDevice.Name =CmbSubDevice;
            this.CmbSubDevice.Size =新System.Drawing.Size(194,24);
            this.CmbSubDevice.TabIndex = 3;
            //
            // BtnBack
            //
            this.BtnBack.Location =新System.Drawing.Point(3,3);
            this.BtnBack.Name =BtnBack;
            this.BtnBack.Size =新System.Drawing.Size(94,54);
            this.BtnBack.TabIndex = 0;
            this.BtnBack.Text =后退;
            this.BtnBack.UseVisualStyleBackColor = TRUE;
            this.BtnBack.Click + =新System.EventHandler(this.BtnBack_Click);
            //
            // CmbMainDevice
            //
            this.tableLayoutPanel1.SetColumnSpan(this.CmbMainDevice,2);
            this.CmbMainDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CmbMainDevice.Font =新System.Drawing.Font(굴림,12F);
            this.CmbMainDevice.FormattingEnabled = TRUE;
            this.CmbMainDevice.Items.AddRange(新对象[] {
            I / O,
            虚拟,
            国资委,
            MODBUS
            国家,
            TOSHIBA,
            时间表,
            系统报警,
            逻辑,
            组});
            this.CmbMainDevice.Location =新System.Drawing.Point(3,69);
            this.CmbMainDevice.Name =CmbMainDevice;
            this.CmbMainDevice.Size =新System.Drawing.Size(194,24);
            this.CmbMainDevice.TabIndex = 2;
            this.CmbMainDevice.SelectedIndexChanged + =新System.EventHandler(this.CmbMainDevice_SelectedIndexChanged);
            //
            // dataGridView1的
            //
            this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Columns.AddRange(新System.Windows.Forms.DataGridViewColumn [] {
            this.ID,
            this.PointName,
            THIS.VALUE,
            this.Description,
            this.DefaultValue,
            this.ActiveString,
            this.InactiveString,
            this.AlarmCondition});
            this.tableLayoutPanel1.SetColumnSpan(this.dataGridView1,6);
            this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dataGridView1.Location =新System.Drawing.Point(3,101);
            this.dataGridView1.Name =dataGridView1的;
            this.dataGridView1.RowTemplate.Height = 23;
            this.dataGridView1.Size =新System.Drawing.Size(633,363);
            this.dataGridView1.TabIndex = 5;
            //
            // BtnRefresh
            //
            this.BtnRefresh.Location =新System.Drawing.Point(403,69);
            this.BtnRefresh.Name =BtnRefresh;
            this.BtnRefresh.Size =新System.Drawing.Size(94,26);
            this.BtnRefresh.TabIndex = 6;
            this.BtnRefresh.Text =刷新;
            this.BtnRefresh.UseVisualStyleBackColor = TRUE;
            //
            // LABEL1
            //
            this.label1.AutoSize =真;
            this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.label1.Font =新System.Drawing.Font(굴림,12F);
            this.label1.Location =新System.Drawing.Point(554,66);
            this.label1.Name =LABEL1;
            this.label1.Size =新System.Drawing.Size(82,32);
            this.label1.TabIndex = 7;
            this.label1.Text =XXX개;
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // ID
            //
            this.ID.FillWeight = 70F;
            this.ID.HeaderText =ID;
            this.ID.Name =ID;
            //
            // PointName
            //
            this.PointName.FillWeight = 70F;
            this.PointName.HeaderText =이름;
            this.PointName.Name =PointName;
            //
            // 值
            //
            this.Value.FillWeight = 70F;
            this.Value.HeaderText =값;
            this.Value.Name =值;
            //
            // 描述
            //
            this.Description.FillWeight = 70F;
            this.Description.HeaderText =설명;
            this.Description.Name =说明;
            //
            // 默认值
            //
            this.DefaultValue.FillWeight = 70F;
            this.DefaultValue.HeaderText =초기값;
            this.DefaultValue.Name =默认值;
            //
            // ActiveString
            //
            this.ActiveString.HeaderText =活动문자열;
            this.ActiveString.Name =ActiveString;
            //
            // InactiveString
            //
            this.InactiveString.HeaderText =无效문자열;
            this.InactiveString.Name =InactiveString;
            //
            // AlarmCondition
            //
            this.AlarmCondition.HeaderText =알람조건;
            this.AlarmCondition.Name =AlarmCondition;
            //
            // PointCtrlForm
            //
            this.AutoScaleDimensions =新System.Drawing.SizeF(7F,12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize =新System.Drawing.Size(639,467);
            this.Controls.Add(this.tableLayoutPanel1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name =PointCtrlForm;
            this.Text =LG-DDC;
            this.tableLayoutPanel1.ResumeLayout(假);
            this.tableLayoutPanel1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1))EndInit()。
            this.ResumeLayout(假);

        }

        #endregion

        私人System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
        私人System.Windows.Forms.Button BtnBack;
        私人System.Windows.Forms.ComboBox CmbMainDevice;
        私人System.Windows.Forms.ComboBox CmbSubDevice;
        私人System.Windows.Forms.DataGridView dataGridView1的;
        私人System.Windows.Forms.Button BtnRefresh;
        私人System.Windows.Forms.Label LABEL1;
        私人System.Windows.Forms.DataGridViewTextBoxColumn ID;
        私人System.Windows.Forms.DataGridViewTextBoxColumn PointName;
        私人System.Windows.Forms.DataGridViewTextBoxColumn价值;
        私人System.Windows.Forms.DataGridViewTextBoxColumn说明;
        私人System.Windows.Forms.DataGridViewTextBoxColumn默认值;
        私人System.Windows.Forms.DataGridViewTextBoxColumn ActiveString;
        私人System.Windows.Forms.DataGridViewTextBoxColumn InactiveString;
        私人System.Windows.Forms.DataGridViewTextBoxColumn AlarmCondition;

    }
}
 

解决方案

我已经找到了解决方案,这是相当简单的。

的行和列大小为DGV已经被置为百分比(相对),以不绝对的对接的正常工作。

您可以编辑的大小通过右键单击该DGV的细胞之一,并点击编辑行/列属性。

I'm not 100% sure how I should word this question but I'll try my best.

I have a PointCtrlForm that has a DataGridView inside a TableLayoutPanel. The DataGridView is docked to the table as Fill. PointCtrlForm is docked to another window set as MDIParent with the dockstyle property set as Fill.

Resizing the main window properly resizes the PointCtrlForm, which then is supposed to resize the DataGridView as well. Well, at least "half" of the resizing works properly. Enlarging the main window also enlarges the datagridview, which is what I expected but if I shrink the main window to a certain point, the DataGridView stops shrinking and hides the columns without showing a scrollbar.

I've checked that all columns do not have Frozen property enabled, checked that both the datagridview and the child window is properly docked, and checked the scrollbars property is set to both.

Edit: AutoSizeColumnsMode is also fill.

I'll post the content of the Designer.cs here. I'd appreciate any guidance.

namespace DDCUI
{
    partial class PointCtrlForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
            this.CmbSubDevice = new System.Windows.Forms.ComboBox();
            this.BtnBack = new System.Windows.Forms.Button();
            this.CmbMainDevice = new System.Windows.Forms.ComboBox();
            this.dataGridView1 = new System.Windows.Forms.DataGridView();
            this.BtnRefresh = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.PointName = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Description = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DefaultValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ActiveString = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.InactiveString = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.AlarmCondition = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.tableLayoutPanel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.SuspendLayout();
            // 
            // tableLayoutPanel1
            // 
            this.tableLayoutPanel1.ColumnCount = 6;
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 151F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 88F));
            this.tableLayoutPanel1.Controls.Add(this.CmbSubDevice, 0, 1);
            this.tableLayoutPanel1.Controls.Add(this.BtnBack, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.CmbMainDevice, 0, 1);
            this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 2);
            this.tableLayoutPanel1.Controls.Add(this.BtnRefresh, 4, 1);
            this.tableLayoutPanel1.Controls.Add(this.label1, 5, 1);
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
            this.tableLayoutPanel1.RowCount = 3;
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 67.02128F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 32.97872F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 368F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
            this.tableLayoutPanel1.Size = new System.Drawing.Size(639, 467);
            this.tableLayoutPanel1.TabIndex = 0;
            // 
            // CmbSubDevice
            // 
            this.tableLayoutPanel1.SetColumnSpan(this.CmbSubDevice, 2);
            this.CmbSubDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CmbSubDevice.Font = new System.Drawing.Font("굴림", 12F);
            this.CmbSubDevice.FormattingEnabled = true;
            this.CmbSubDevice.Location = new System.Drawing.Point(203, 69);
            this.CmbSubDevice.Name = "CmbSubDevice";
            this.CmbSubDevice.Size = new System.Drawing.Size(194, 24);
            this.CmbSubDevice.TabIndex = 3;
            // 
            // BtnBack
            // 
            this.BtnBack.Location = new System.Drawing.Point(3, 3);
            this.BtnBack.Name = "BtnBack";
            this.BtnBack.Size = new System.Drawing.Size(94, 54);
            this.BtnBack.TabIndex = 0;
            this.BtnBack.Text = "Back";
            this.BtnBack.UseVisualStyleBackColor = true;
            this.BtnBack.Click += new System.EventHandler(this.BtnBack_Click);
            // 
            // CmbMainDevice
            // 
            this.tableLayoutPanel1.SetColumnSpan(this.CmbMainDevice, 2);
            this.CmbMainDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CmbMainDevice.Font = new System.Drawing.Font("굴림", 12F);
            this.CmbMainDevice.FormattingEnabled = true;
            this.CmbMainDevice.Items.AddRange(new object[] {
            "I/O",
            "VIRTUAL",
            "SAC",
            "MODBUS",
            "NATIONAL",
            "TOSHIBA",
            "SCHEDULE",
            "SYSTEM ALARM",
            "LOGIC",
            "GROUP"});
            this.CmbMainDevice.Location = new System.Drawing.Point(3, 69);
            this.CmbMainDevice.Name = "CmbMainDevice";
            this.CmbMainDevice.Size = new System.Drawing.Size(194, 24);
            this.CmbMainDevice.TabIndex = 2;
            this.CmbMainDevice.SelectedIndexChanged += new System.EventHandler(this.CmbMainDevice_SelectedIndexChanged);
            // 
            // dataGridView1
            // 
            this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.ID,
            this.PointName,
            this.Value,
            this.Description,
            this.DefaultValue,
            this.ActiveString,
            this.InactiveString,
            this.AlarmCondition});
            this.tableLayoutPanel1.SetColumnSpan(this.dataGridView1, 6);
            this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dataGridView1.Location = new System.Drawing.Point(3, 101);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.RowTemplate.Height = 23;
            this.dataGridView1.Size = new System.Drawing.Size(633, 363);
            this.dataGridView1.TabIndex = 5;
            // 
            // BtnRefresh
            // 
            this.BtnRefresh.Location = new System.Drawing.Point(403, 69);
            this.BtnRefresh.Name = "BtnRefresh";
            this.BtnRefresh.Size = new System.Drawing.Size(94, 26);
            this.BtnRefresh.TabIndex = 6;
            this.BtnRefresh.Text = "Refresh";
            this.BtnRefresh.UseVisualStyleBackColor = true;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.label1.Font = new System.Drawing.Font("굴림", 12F);
            this.label1.Location = new System.Drawing.Point(554, 66);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(82, 32);
            this.label1.TabIndex = 7;
            this.label1.Text = "XXX 개";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // ID
            // 
            this.ID.FillWeight = 70F;
            this.ID.HeaderText = "ID";
            this.ID.Name = "ID";
            // 
            // PointName
            // 
            this.PointName.FillWeight = 70F;
            this.PointName.HeaderText = "이름";
            this.PointName.Name = "PointName";
            // 
            // Value
            // 
            this.Value.FillWeight = 70F;
            this.Value.HeaderText = "값";
            this.Value.Name = "Value";
            // 
            // Description
            // 
            this.Description.FillWeight = 70F;
            this.Description.HeaderText = "설명";
            this.Description.Name = "Description";
            // 
            // DefaultValue
            // 
            this.DefaultValue.FillWeight = 70F;
            this.DefaultValue.HeaderText = "초기값";
            this.DefaultValue.Name = "DefaultValue";
            // 
            // ActiveString
            // 
            this.ActiveString.HeaderText = "Active문자열";
            this.ActiveString.Name = "ActiveString";
            // 
            // InactiveString
            // 
            this.InactiveString.HeaderText = "InActive문자열";
            this.InactiveString.Name = "InactiveString";
            // 
            // AlarmCondition
            // 
            this.AlarmCondition.HeaderText = "알람조건";
            this.AlarmCondition.Name = "AlarmCondition";
            // 
            // PointCtrlForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(639, 467);
            this.Controls.Add(this.tableLayoutPanel1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "PointCtrlForm";
            this.Text = "LG-DDC";
            this.tableLayoutPanel1.ResumeLayout(false);
            this.tableLayoutPanel1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
        private System.Windows.Forms.Button BtnBack;
        private System.Windows.Forms.ComboBox CmbMainDevice;
        private System.Windows.Forms.ComboBox CmbSubDevice;
        private System.Windows.Forms.DataGridView dataGridView1;
        private System.Windows.Forms.Button BtnRefresh;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.DataGridViewTextBoxColumn ID;
        private System.Windows.Forms.DataGridViewTextBoxColumn PointName;
        private System.Windows.Forms.DataGridViewTextBoxColumn Value;
        private System.Windows.Forms.DataGridViewTextBoxColumn Description;
        private System.Windows.Forms.DataGridViewTextBoxColumn DefaultValue;
        private System.Windows.Forms.DataGridViewTextBoxColumn ActiveString;
        private System.Windows.Forms.DataGridViewTextBoxColumn InactiveString;
        private System.Windows.Forms.DataGridViewTextBoxColumn AlarmCondition;

    }
}

解决方案

I've found the solution and it's rather simple.

The row and column sizes for the DGV has to be set "percentage (relative)" not "absolute" in order for the docking to work properly.

You can edit the sizes by right clicking on one of the cells of the DGV and clicking on Edit Row/Column Properties.

这篇关于的WinForms DataGridView的调整问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆