|
@@ -13,6 +13,22 @@ namespace UAS_MES.CustomControl.DataGrid_View
|
|
|
public partial class DataGridViewWithSerialNum : DataGridView
|
|
|
{
|
|
|
SolidBrush solidBrush;
|
|
|
+
|
|
|
+ bool EnableContentClick1 = true;
|
|
|
+
|
|
|
+ public bool EnableContentClick
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return EnableContentClick1;
|
|
|
+ }
|
|
|
+
|
|
|
+ set
|
|
|
+ {
|
|
|
+ EnableContentClick1 = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public DataGridViewWithSerialNum()
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -27,24 +43,28 @@ namespace UAS_MES.CustomControl.DataGrid_View
|
|
|
|
|
|
private void DataGridViewWithSerialNum_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
- if (Columns[0] is DataGridViewCheckBoxColumn && e.ColumnIndex >= 0 && e.RowIndex >= 0)
|
|
|
+ if (EnableContentClick1)
|
|
|
{
|
|
|
- if (!(Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn)&&!(Columns[e.ColumnIndex] is DataGridViewComboBoxColumn))
|
|
|
+ if (Columns[0] is DataGridViewCheckBoxColumn && e.ColumnIndex >= 0 && e.RowIndex >= 0)
|
|
|
{
|
|
|
- if (Rows[e.RowIndex].Cells[0].Value != null)
|
|
|
+ if (!(Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn) && !(Columns[e.ColumnIndex] is DataGridViewComboBoxColumn))
|
|
|
{
|
|
|
- if (Rows[e.RowIndex].Cells[0].Value.ToString() == "0")
|
|
|
+ if (Rows[e.RowIndex].Cells[0].Value != null)
|
|
|
{
|
|
|
- Rows[e.RowIndex].Cells[0].Value = 1;
|
|
|
+ if (Rows[e.RowIndex].Cells[0].Value.ToString() == "0")
|
|
|
+ {
|
|
|
+ Rows[e.RowIndex].Cells[0].Value = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Rows[e.RowIndex].Cells[0].Value = 0;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Rows[e.RowIndex].Cells[0].Value = 0;
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- Rows[e.RowIndex].Cells[0].Value = 0;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|