| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Windows.Forms;
- namespace UAS_MES_NEW.CustomControl.ButtonUtil
- {
- public partial class ChooseAllButton : Button
- {
- DataGridView DGV;
- bool AllChecked = false;
- public ChooseAllButton()
- {
- InitializeComponent();
- }
- public void ChooseAll(DataGridView dgv)
- {
- DGV = dgv;
- Click += ChooseAll_Click;
- }
- private void ChooseAll_Click(object sender, EventArgs e)
- {
- if (AllChecked)
- {
- for (int i = 0; i < DGV.RowCount; i++)
- {
- DGV.Rows[i].Cells[0].Value = false;
- }
- AllChecked = false;
- }
- else
- {
- for (int i = 0; i < DGV.RowCount; i++)
- {
- DGV.Rows[i].Cells[0].Value = true;
- }
- AllChecked = true;
- }
- }
- }
- }
|