/// <summary> /// Event: Menu -> Cover Monitors -> Single Monitor /// Multi monitor support: allows the user to select which single monitor should be covered by the drape. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">Empty event data.</param> private void EventMenuDrapeMonitorsClick(object sender, EventArgs e) { if (this.afterStartup) { this.Bounds = MultiMonitorSupport.ScreenBoundsFromMenuItem(sender); } }
// ******************************************************************** // Form Location // ******************************************************************** /// <summary> /// Ensures the quick start form is located on a visible monitor (on multi-monitor configurations). /// </summary> public void EnsureOnscreen() { if (!MultiMonitorSupport.IsOnAScreen(this.Bounds)) { this.SetDefaultLocation(); } }
// *********** // Events - Init Menus // *********** /// <summary> /// Finalizes the menus - adds the opacity track bar, the multi monitor support items, modernizes the menu, etc. /// </summary> private void FinalizeMenus() { // Add the opacity track bar this.menuOpacityTrackBar = new TrackBar() { BackColor = Color.Black, Minimum = 1, Maximum = 100, Value = (int)(this.Opacity * 100), TickFrequency = 5, Width = this.menuMainAbout.DropDown.Width, // A good default value for the width of the track bar is the width of its parent menu item }; this.menuOpacityTrackBar.Scroll += this.EventMenuOpacityTrackBarScroll; this.menuMainOpacity.DropDownItems.Add(new ToolStripControlHost(this.menuOpacityTrackBar)); // Add the multi monitor support menu items MultiMonitorSupport.RadioCheckImage = this.GetRadioCheckBitmap(); if (!MultiMonitorSupport.AddMonitorMenuItems(this.menuMainCoverMonitors.DropDown, this.EventMenuDrapeAllMonitorsClick, this.EventMenuDrapeMonitorsClick)) { this.menuMainCoverMonitors.Visible = false; } // Add the current build number to the About->Version menu item this.menuMainAboutVersion.Text += Application.ProductVersion; // Modernize the menu, with a black background and an Aurelitec blue hightlight MenuToolStripCustomizer customizer = MenuToolStripCustomizer.Modernize( Color.FromArgb(10, 10, 10), this.appColor, Color.White, 10, 0.8d, null, this.menuMain, this.menuFocus); customizer.ColorTable.ColorOfImageMarginGradientBegin = customizer.ColorTable.ColorOfImageMarginGradientMiddle = customizer.ColorTable.ColorOfImageMarginGradientEnd = Color.FromArgb(20, 20, 20); }