예제 #1
0
        private void SetAllRowChecked(bool chk, DataGridView dgv, string chkname)
        {
            for (int i = 0; i < dgv.Rows.Count; i++)
            {
                DataGridViewDisableCheckBoxCell checkCell = (DataGridViewDisableCheckBoxCell)dgv.Rows[i].Cells[chkname];
                Boolean flag  = Convert.ToBoolean(checkCell.Value);
                string  value = dgv.Rows[i].Cells[2].Value.ToString();
                if (flag != chk)
                {
                    checkCell.Value = chk;
                }

                if (value == RMEnum.操作成功.ToString())
                {
                    checkCell.Value = false;
                }

                if (value == RMEnum.操作处理中.ToString())
                {
                    checkCell.Value = true;
                }

                if (RMEnumStatus == RMEnum.待操作 && chk)
                {
                    checkCell.Enabled  = true;
                    checkCell.ReadOnly = false;
                }
                continue;
            }
        }
예제 #2
0
        /// Override the Clone method so that the Enabled property is copied.
        public override object Clone()
        {
            DataGridViewDisableCheckBoxCell cell =
                (DataGridViewDisableCheckBoxCell)base.Clone();

            cell.Enabled = this.Enabled;
            return(cell);
        }
예제 #3
0
        private void SetDgvStoresState()
        {
            for (int i = 0; i < DgvStores.Rows.Count; i++)
            {
                DataGridViewDisableCheckBoxCell checkCell = (DataGridViewDisableCheckBoxCell)DgvStores.Rows[i].Cells[0];
                string resultValue = DgvStores.Rows[i].Cells[2].Value.ToString();

                if (resultValue == RMEnum.操作失败.ToString())
                {
                    checkCell.Enabled  = false;
                    checkCell.ReadOnly = true;
                    chk_stores.Enabled = true;
                }
                else
                {
                    checkCell.Enabled  = true;
                    checkCell.ReadOnly = false;
                }
            }
            this.DgvStores.Refresh();
        }
예제 #4
0
        private void DgvStores_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 && e.RowIndex != -1)
            {
                DataGridViewDisableCheckBoxCell checkCell = (DataGridViewDisableCheckBoxCell)DgvStores.Rows[e.RowIndex].Cells[0];
                if (!checkCell.Enabled)
                {
                    string number = DgvStores.Rows[e.RowIndex].Cells[1].Value.ToString();
                    if ((bool)DgvStores.Rows[e.RowIndex].Cells[0].EditedFormattedValue == true)
                    {
                        DgvStores.Rows[e.RowIndex].Cells[0].Value = false;
                    }
                    else
                    {
                        DgvStores.Rows[e.RowIndex].Cells[0].Value = true;
                    }

                    //反选
                    int i = 0;
                    foreach (DataGridViewRow row in DgvStores.Rows)
                    {
                        if ((bool)row.Cells[0].EditedFormattedValue || row.Cells[2].Value.ToString() == RMEnum.操作成功.ToString())
                        {
                            i++;
                        }
                    }
                    if (i == DgvStores.Rows.Count)
                    {
                        chk_stores.Checked = true;
                    }
                    else
                    {
                        chk_stores.Checked = false;
                    }
                }
            }
        }