/// <summary> /// Raises the BeforeFullScreenChanged event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnBeforeFullScreenChanged(object sender, FullScreenCancelEventArgs e) { try { if (this.BeforeFullScreenChanged != null) { this.BeforeFullScreenChanged(sender, e); } } catch (System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } }
/// <summary> /// Sets the attributes of the window to better accomodate fullscreen operation, or restores it to the previous restored state /// </summary> /// <param name="isFullScreen"></param> private bool SwitchToFullScreen(bool isfullScreenBefore, bool isFullScreenAfter) { // raise the before changed event FullScreenCancelEventArgs ce = new FullScreenCancelEventArgs(_isFullScreen, false); this.OnBeforeFullScreenChanged(this, ce); // if the change wasn't cancelled if (!ce.Cancel) { // modify the fullscreen state if (isFullScreenAfter) { // it is supposed to be fullscreen _windowState = this.WindowState; this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; } else { // it isn't supposed to be fullscreen this.WindowState = _windowState; this.FormBorderStyle = FormBorderStyle.Sizable; this.Location = _location; this.Size = _size; } // raise the after changed event this.OnAfterFullScreenChanged(this, new FullScreenEventArgs(isFullScreenAfter)); // changes were made return(true); } // no change was made return(false); }
/// <summary> /// Sets the attributes of the window to better accomodate fullscreen operation, or restores it to the previous restored state /// </summary> /// <param name="isFullScreen"></param> private bool SwitchToFullScreen(bool isfullScreenBefore, bool isFullScreenAfter) { // raise the before changed event FullScreenCancelEventArgs ce = new FullScreenCancelEventArgs(_isFullScreen, false); this.OnBeforeFullScreenChanged(this, ce); // if the change wasn't cancelled if (!ce.Cancel) { // modify the fullscreen state if (isFullScreenAfter) { // it is supposed to be fullscreen _windowState = this.WindowState; this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; } else { // it isn't supposed to be fullscreen this.WindowState = _windowState; this.FormBorderStyle = FormBorderStyle.Sizable; this.Location = _location; this.Size = _size; } // raise the after changed event this.OnAfterFullScreenChanged(this, new FullScreenEventArgs(isFullScreenAfter)); // changes were made return true; } // no change was made return false; }
/// <summary> /// Raises the BeforeFullScreenChanged event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnBeforeFullScreenChanged(object sender, FullScreenCancelEventArgs e) { try { if (this.BeforeFullScreenChanged != null) this.BeforeFullScreenChanged(sender, e); } catch(System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } }