示例#1
0
 /// <summary>
 /// Registered event for the window when the mouse is held.
 /// Allows us to move the window around by dragging the background.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Window_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (_overlayHelper.WindowFollowMode != WindowFollowMode.Overlay)
     {
         // Reusing Reloaded-GUI's (Launcher Theming/Utility Library)
         MoveWindow.MoveTheWindow(new WindowInteropHelper(this).Handle);
     }
 }
示例#2
0
        /// <summary>
        /// Themes an individual windows forms control.
        /// </summary>
        /// <param name="control"></param>
        private static void ThemeControl(Control control)
        {
            // Apply the appropriate fonts to the control.
            ApplyFonts(control);

            // Theme the Category, Main and Title Buttons
            if (IsMainItem(control))
            {
                ThemeButton(control, Theme.ThemeProperties.MainColours, Theme.ThemeProperties.MainEnterAnimation, Theme.ThemeProperties.MainLeaveAnimation, true);
            }

            else if (IsCategoryItem(control))
            {
                ThemeButton(control, Theme.ThemeProperties.CategoryColours, Theme.ThemeProperties.CategoryEnterAnimation, Theme.ThemeProperties.CategoryLeaveAnimation, false);
            }

            else if (IsBox(control))
            {
                ThemeButton(control, Theme.ThemeProperties.BoxColours, Theme.ThemeProperties.BoxEnterAnimation, Theme.ThemeProperties.BoxLeaveAnimation, true);
            }

            else if (IsBorderless(control))
            {
                ThemeButton(control, Theme.ThemeProperties.BorderlessColours, Theme.ThemeProperties.BorderlessEnterAnimation, Theme.ThemeProperties.BorderlessLeaveAnimation, false);
            }

            else if (IsTitleItem(control))
            {
                ThemeButton(control, Theme.ThemeProperties.TitleColours, Theme.ThemeProperties.TitleEnterAnimation, Theme.ThemeProperties.TitleLeaveAnimation, false);

                // Automatic Dragging!
                control.MouseDown += (sender, args) => MoveWindow.MoveTheWindow(control.FindForm().Handle);
            }

            else
            {
                ThemeButton(control, Theme.ThemeProperties.MainColours, Theme.ThemeProperties.MainEnterAnimation, Theme.ThemeProperties.MainLeaveAnimation, true);
            }

            if (!control.Name.StartsWith("box_"))
            {
                foreach (Control controlEmbedded in control.Controls)
                {
                    ThemeControl(controlEmbedded);
                }
            }
        }