splitContainer面板上的多个ListView宽度分布

时间:2019-04-09 02:53:34

标签: c# listview panel

我正在使用Windows窗体,该窗体在SplitContianer中包含三个listview,我使用Anchor / Dock属性调整ListView的方式如下:一个Listview(向左停靠),第二个(向右停靠)和第三个(居于居中)使用了锚属性(左,右,上,下)。它在15英寸的屏幕上工作正常,但是当监视器屏幕增加中间驻留的列表视图时,看起来比其余两个列表视图要大。因此,我如何固定所有listView的宽度,从而可以在所有类型的监视器屏幕中调整所有listview的宽度。

 // listView1
        // 
        this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {            
        this.listView1.Dock = System.Windows.Forms.DockStyle.Left;
        this.listView1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.listView1.FullRowSelect = true;
        this.listView1.Location = new System.Drawing.Point(0, 0);
        this.listView1.Name = "listView1";
        this.listView1.Size = new System.Drawing.Size(340, 419);
        this.listView1.UseCompatibleStateImageBehavior = false;
        this.listView1.View = System.Windows.Forms.View.Details;
        // 
        // listView2
        // 
        this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                    | System.Windows.Forms.AnchorStyles.Left)
                    | System.Windows.Forms.AnchorStyles.Right)));

        this.listView2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
       this.listView2.Location = new System.Drawing.Point(251, 0);
        this.listView2.Size = new System.Drawing.Size(340, 416)
          // listView5
        // 

        this.listView5.Dock = System.Windows.Forms.DockStyle.Right;
        this.listView5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.listView5.Location = new System.Drawing.Point(563, 0);
        this.listView5.Size = new System.Drawing.Size(340, 419);

0 个答案:

没有答案