private void dataGridView_smsList_전체체크버튼() { bool 한개라도체크된부분확인 = false; for (int i = 0; i < dataGridView_smsList.Rows.Count; i++) { if (Convert.ToBoolean(dataGridView_smsList.Rows[i].Cells[SMS_LIST_COLUMN_CHECKBOX].Value)) { 한개라도체크된부분확인 = true; } } if (한개라도체크된부분확인) { 한개라도체크된부분확인 = false; } else { 한개라도체크된부분확인 = true; } for (int i = 0; i < dataGridView_smsList.Rows.Count; i++) { dataGridView_smsList.Rows[i].Cells[SMS_LIST_COLUMN_CHECKBOX].Value = 한개라도체크된부분확인; } dateGridView_Update(); } private void dataGridView_smsList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { if (e.ColumnIndex == SMS_LIST_COLUMN_CHECKBOX) { dataGridView_smsList_전체체크버튼(); } } else { //이부분이 없으면 개별 Cell 클릭시 반응 한템포 느려짐 dataGridView_smsList.CommitEdit(DataGridViewDataErrorContexts.Commit); } } private void dataGridView_smsList_CellValueChanged(object sender, DataGridViewCellEventArgs e) { dateGridView_Update(); } private void dateGridView_Update() { dataGridView_smsList.Invoke( new Action( delegate() { button_전체선택.Focus(); dataGridView_smsList.Focus(); int smsListCount = 0; for (int i = 0; i < dataGridView_smsList.Rows.Count; i++) { if (Convert.ToBoolean(dataGridView_smsList.Rows[i].Cells[SMS_LIST_COLUMN_CHECKBOX].Value)) { smsListCount++; } } label_smsList_count.Text = string.Format("문자발송 LIST [ 선택: {0} / 전체: {1} ]", smsListCount, dataGridView_smsList.Rows.Count); } )); }
solved