checkBox1 ? , , ( checkBox1.Visible, ControlVisible), , .
, InitializeControls Form1.designer.cs, ?
, ShouldSerialze Reset , .
Edit
VS . , ControlVisible VS, false, checkBox1.Visible ( ) false. , "" ControlVisible, , true, , , VS , . VS.
:
public BaseForm()
{
InitializeComponent();
_testValue = false;
}
private bool _testValue;
[DefaultValue(true)]
public bool TestProperty
{
get { return _testValue; }
set { _testValue = value; }
}
protected override void OnVisibleChanged(EventArgs e)
{
_testValue = true;
base.OnVisibleChanged(e);
}
}
BaseForm TestPropery , ControlVisible , , VS.
, bool , checkBox1.Visible :
public BaseForm()
{
InitializeComponent();
checkBox1.Visible = _controlVisible = true;
}
private bool _controlVisible;
[DefaultValue(true)]
public bool ControlVisible
{
get { return _controlVisible; }
set { _controlVisible = checkBox1.Visible = value; }
}