コード例 #1
0
        // ***********
        // 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);
        }