/// <summary>
        /// 初始化DGV的一些东西
        /// </summary>
        private void InitDataGridView()
        {
            //取消自动设置列功能
            dataGridView1.AutoGenerateColumns = false;
            //添加播放按钮
            MyDataGridViewTextBoxColumn btnStart = new MyDataGridViewTextBoxColumn();

            btnStart.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            btnStart.SortMode = DataGridViewColumnSortMode.NotSortable;

            btnStart.Name       = "btnStart";
            btnStart.HeaderText = "操作";
            btnStart.DefaultCellStyle.NullValue = playName;
            btnStart.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns.Add(btnStart);

            //添加停止按钮
            MyDataGridViewTextBoxColumn btnStop = new MyDataGridViewTextBoxColumn();

            btnStop.Name       = "btnStop";
            btnStop.HeaderText = "操作";
            btnStop.DefaultCellStyle.NullValue = stopName;
            btnStop.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns.Add(btnStop);

            ////绑定排片表
            dataGridView1.DataSource = blList;
            //对表做一些微处理
            dataGridView1.Columns[0].MinimumWidth = 100;
            dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
        }
Beispiel #2
0
        private void InitDataGridView()
        {
            dataGridView2.AutoGenerateColumns = false;

            //添加按钮
            MyDataGridViewTextBoxColumn txtUpdate = new MyDataGridViewTextBoxColumn();

            txtUpdate.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            txtUpdate.SortMode   = DataGridViewColumnSortMode.NotSortable;
            txtUpdate.ReadOnly   = true;
            txtUpdate.Name       = "btnStart";
            txtUpdate.HeaderText = "操作";
            txtUpdate.DefaultCellStyle.NullValue = "更新";
            txtUpdate.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            //添加按钮
            MyDataGridViewTextBoxColumn txtDel = new MyDataGridViewTextBoxColumn();

            txtDel.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            txtDel.SortMode   = DataGridViewColumnSortMode.NotSortable;
            txtDel.ReadOnly   = true;
            txtDel.Name       = "btnStart";
            txtDel.HeaderText = "操作";
            txtDel.DefaultCellStyle.NullValue = "删除";
            txtDel.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            dataGridView2.Columns.Add(txtUpdate);
            dataGridView2.Columns.Add(txtDel);
            initTable();
            txtName.Select();
        }