private void startMagnifier() { if (magnifierButton.Checked) { if (Properties.Settings.Default.isLens) { magnifierWindowLens = new magnifier(Properties.Settings.Default.isLens); magnifierWindowLens.Show(); mgnLens = new Karna.Magnification.Magnifier(magnifierWindowLens, Properties.Settings.Default.isLens); magnifierWindowLens.FormClosing += uncheckMagnifier; mgnLens.Magnification = (float)(Properties.Settings.Default.magnificationRate + 2.0) / 2; } else { magnifierWindowDocked = new magnifier(Properties.Settings.Default.isLens); magnifierWindowDocked.Show(); mgnDocked = new Magnifier(magnifierWindowDocked, Properties.Settings.Default.isLens); magnifierWindowDocked.FormClosing += uncheckMagnifier; mgnDocked.Magnification = (float)(Properties.Settings.Default.magnificationRate + 2.0) / 2; } } else { if (magnifierWindowLens != null && !magnifierWindowLens.IsDisposed) { magnifierWindowLens.Close(); magnifierWindowLens.Dispose(); } if (magnifierWindowDocked != null && !magnifierWindowDocked.IsDisposed) { magnifierWindowDocked.Close(); magnifierWindowDocked.Dispose(); } } }