qq_25211827
Dream丶飞
采纳率25%
2018-07-22 06:02 阅读 1.5k

C#的Froms的ListView的复选框如何实现单独一列居中显示

5

就如我上传的图片一样,复选框单独的一列显示,查了很多网上的文献都没有解决图片说明

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    caozhy 从今以后生命中的每一秒都属于我爱的人 2018-07-22 06:26

    把表头去掉就更像listview了
    图片说明

    点赞 评论 复制链接分享
  • caozhy 从今以后生命中的每一秒都属于我爱的人 2018-07-22 06:17

    直接用DataGridView代替ListView
    图片说明

    点赞 评论 复制链接分享
  • caozhy 从今以后生命中的每一秒都属于我爱的人 2018-07-22 07:28

    你新建一个winforms项目,窗体叫做form1
    打开form1.designer.cs
    复制以下代码:

     namespace Q695397
    {
        partial class Form1
        {
            /// <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.dataGridView1 = new System.Windows.Forms.DataGridView();
                this.Column1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
                this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
                this.SuspendLayout();
                // 
                // dataGridView1
                // 
                this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.Column1,
                this.Column2,
                this.Column3});
                this.dataGridView1.Location = new System.Drawing.Point(12, 12);
                this.dataGridView1.Name = "dataGridView1";
                this.dataGridView1.RowHeadersVisible = false;
                this.dataGridView1.Size = new System.Drawing.Size(354, 246);
                this.dataGridView1.TabIndex = 0;
                // 
                // Column1
                // 
                this.Column1.Frozen = true;
                this.Column1.HeaderText = "选择";
                this.Column1.Name = "Column1";
                // 
                // Column2
                // 
                this.Column2.HeaderText = "名称";
                this.Column2.Name = "Column2";
                // 
                // Column3
                // 
                this.Column3.HeaderText = "数量";
                this.Column3.Name = "Column3";
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(444, 341);
                this.Controls.Add(this.dataGridView1);
                this.Name = "Form1";
                this.Text = "Form1";
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
                this.ResumeLayout(false);
    
            }
    
            #endregion
    
            private System.Windows.Forms.DataGridView dataGridView1;
            private System.Windows.Forms.DataGridViewCheckBoxColumn Column1;
            private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
            private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
        }
    }
    
    
    
    点赞 评论 复制链接分享

相关推荐