private void ckbShowLog_CheckedChanged(object sender, EventArgs e) { if ((sender as CheckBox).Checked) { mLogForm = new FrmLog(); this.mLogForm.FormClosed += new FormClosedEventHandler(LogForm_FormClosed); this.mLogForm.Show(this); } else { if (this.mLogForm != null && !this.mLogForm.IsDisposed && this.mLogForm.Visible) { this.mLogForm.Close(); this.mLogForm.Dispose(); this.mLogForm = null; } } }