галка пустого значения накладывалась на элемент вывода

This commit is contained in:
kotcheshir73 2021-04-08 10:43:44 +04:00
parent a5ac4947d0
commit 1f4ee6b285
5 changed files with 43 additions and 42 deletions

View File

@ -20,6 +20,9 @@ namespace DesktopTools.BaseControls
InitializeComponent(); InitializeComponent();
_baseControl = this; _baseControl = this;
checkBox.CheckedChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
panelControl.Controls.Add(checkBox);
if (!_mustFilling) if (!_mustFilling)
{ {
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
@ -29,9 +32,6 @@ namespace DesktopTools.BaseControls
}; };
panelControl.Controls.Add(checkBoxNullable); panelControl.Controls.Add(checkBoxNullable);
} }
checkBox.CheckedChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
panelControl.Controls.Add(checkBox);
} }
public void SetDefaultValue() => _originalValue = _mustFilling ? false : null; public void SetDefaultValue() => _originalValue = _mustFilling ? false : null;

View File

@ -24,16 +24,6 @@ namespace DesktopTools.BaseControls
InitializeComponent(); InitializeComponent();
_baseControl = this; _baseControl = this;
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
dateTimePicker.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
dateTimePicker.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; dateTimePicker.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
if (minDate > DateTime.MinValue) if (minDate > DateTime.MinValue)
{ {
@ -48,6 +38,16 @@ namespace DesktopTools.BaseControls
dateTimePicker.CustomFormat = customDateFormat; dateTimePicker.CustomFormat = customDateFormat;
} }
panelControl.Controls.Add(dateTimePicker); panelControl.Controls.Add(dateTimePicker);
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
dateTimePicker.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
} }
public void SetDefaultValue() => _originalValue = _mustFilling ? DateTime.Now : null; public void SetDefaultValue() => _originalValue = _mustFilling ? DateTime.Now : null;

View File

@ -23,16 +23,6 @@ namespace DesktopTools.BaseControls
InitializeComponent(); InitializeComponent();
_baseControl = this; _baseControl = this;
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
numericUpDown.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
numericUpDown.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; numericUpDown.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
if (minValue != 0) if (minValue != 0)
{ {
@ -47,6 +37,16 @@ namespace DesktopTools.BaseControls
numericUpDown.DecimalPlaces = decimalPlaces; numericUpDown.DecimalPlaces = decimalPlaces;
} }
panelControl.Controls.Add(numericUpDown); panelControl.Controls.Add(numericUpDown);
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
numericUpDown.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
} }
public void SetDefaultValue() => _originalValue = _mustFilling ? 0 : null; public void SetDefaultValue() => _originalValue = _mustFilling ? 0 : null;

View File

@ -22,15 +22,6 @@ namespace DesktopTools.BaseControls
InitializeComponent(); InitializeComponent();
_baseControl = this; _baseControl = this;
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
comboBox.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
if (enumType.Name.StartsWith("Nullable")) if (enumType.Name.StartsWith("Nullable"))
{ {
enumType = Nullable.GetUnderlyingType(enumType); enumType = Nullable.GetUnderlyingType(enumType);
@ -43,6 +34,16 @@ namespace DesktopTools.BaseControls
} }
comboBox.SelectedIndexChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; comboBox.SelectedIndexChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
panelControl.Controls.Add(comboBox); panelControl.Controls.Add(comboBox);
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
comboBox.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
} }
public void SetDefaultValue() => _originalValue = null; public void SetDefaultValue() => _originalValue = null;

View File

@ -22,16 +22,6 @@ namespace DesktopTools.BaseControls
InitializeComponent(); InitializeComponent();
_baseControl = this; _baseControl = this;
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
numericUpDown.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
numericUpDown.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; numericUpDown.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
if (minValue != 0) if (minValue != 0)
{ {
@ -42,6 +32,16 @@ namespace DesktopTools.BaseControls
numericUpDown.Maximum = maxValue; numericUpDown.Maximum = maxValue;
} }
panelControl.Controls.Add(numericUpDown); panelControl.Controls.Add(numericUpDown);
if (!_mustFilling)
{
checkBoxNullable.CheckedChanged += (object sender, EventArgs e) =>
{
numericUpDown.Enabled = !(sender as CheckBox).Checked;
CallOnValueChangeEvent();
};
panelControl.Controls.Add(checkBoxNullable);
}
} }
public void SetDefaultValue() => _originalValue = _mustFilling ? 0 : null; public void SetDefaultValue() => _originalValue = _mustFilling ? 0 : null;