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

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

View File

@ -24,16 +24,6 @@ namespace DesktopTools.BaseControls
InitializeComponent();
_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(); };
if (minDate > DateTime.MinValue)
{
@ -48,6 +38,16 @@ namespace DesktopTools.BaseControls
dateTimePicker.CustomFormat = customDateFormat;
}
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;

View File

@ -23,16 +23,6 @@ namespace DesktopTools.BaseControls
InitializeComponent();
_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(); };
if (minValue != 0)
{
@ -47,6 +37,16 @@ namespace DesktopTools.BaseControls
numericUpDown.DecimalPlaces = decimalPlaces;
}
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;

View File

@ -22,15 +22,6 @@ namespace DesktopTools.BaseControls
InitializeComponent();
_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"))
{
enumType = Nullable.GetUnderlyingType(enumType);
@ -43,6 +34,16 @@ namespace DesktopTools.BaseControls
}
comboBox.SelectedIndexChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); };
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;

View File

@ -22,16 +22,6 @@ namespace DesktopTools.BaseControls
InitializeComponent();
_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(); };
if (minValue != 0)
{
@ -42,6 +32,16 @@ namespace DesktopTools.BaseControls
numericUpDown.Maximum = maxValue;
}
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;