/// <summary> /// Use the obscurer to cover the provided control. /// </summary> /// <param name="f">Form to obscure.</param> public void Cover(Form f) { // Check the incoming form is valid if ((f != null) && !f.IsDisposed) { // Show over top of the provided form _obscurer?.ShowForm(f.Bounds); } }
/// <summary> /// Initialize a new instance of the ControlObscurer class. /// </summary> /// <param name="f">Form to obscure.</param> /// <param name="designMode">Is the source in design mode.</param> public ScreenObscurer(Form f, bool designMode) { // Check the incoming form is valid if ((f != null) && !f.IsDisposed && !designMode) { // First time needed, create the top level obscurer window if (_obscurer == null) { _obscurer = new ObscurerForm(); } // We need a control to work with! _obscurer.ShowForm(f.Bounds); } }