Fix VS screaming at me regarding the options form; now move checkbox state to form load.

This commit is contained in:
kougyoku 2019-11-07 09:46:48 -08:00
parent e7d5a61c19
commit c5574efdfd
2 changed files with 23 additions and 18 deletions

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmOptions));
this.cbConfirmDelete = new System.Windows.Forms.CheckBox();
this.btnSaveClose = new System.Windows.Forms.Button();
this.SuspendLayout();
@ -35,24 +36,6 @@
// cbConfirmDelete
//
this.cbConfirmDelete.AutoSize = true;
// Toggle the checkbox based on the confirmdelete option.
switch(Properties.Settings.Default.ConfirmDelete)
{
case true:
{
this.cbConfirmDelete.Checked = true;
this.cbConfirmDelete.CheckState = System.Windows.Forms.CheckState.Checked;
break;
}
case false:
{
this.cbConfirmDelete.Checked = false;
this.cbConfirmDelete.CheckState = System.Windows.Forms.CheckState.Unchecked;
break;
}
}
this.cbConfirmDelete.Location = new System.Drawing.Point(13, 31);
this.cbConfirmDelete.Name = "cbConfirmDelete";
this.cbConfirmDelete.Size = new System.Drawing.Size(355, 24);
@ -78,8 +61,10 @@
this.ClientSize = new System.Drawing.Size(382, 122);
this.Controls.Add(this.btnSaveClose);
this.Controls.Add(this.cbConfirmDelete);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmOptions";
this.Text = "Options";
this.Load += new System.EventHandler(this.frmOptions_Load);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -29,5 +29,25 @@ namespace QueueSys
}
Properties.Settings.Default.Save();
}
private void frmOptions_Load(object sender, EventArgs e)
{
// Toggle the checkbox based on the confirmdelete option.
switch (Properties.Settings.Default.ConfirmDelete)
{
case true:
{
this.cbConfirmDelete.Checked = true;
this.cbConfirmDelete.CheckState = System.Windows.Forms.CheckState.Checked;
break;
}
case false:
{
this.cbConfirmDelete.Checked = false;
this.cbConfirmDelete.CheckState = System.Windows.Forms.CheckState.Unchecked;
break;
}
}
}
}
}