Пример #1
0
        // Token: 0x060000B2 RID: 178 RVA: 0x00004078 File Offset: 0x00002278
        private void MetroToolTip_Popup(object sender, PopupEventArgs e)
        {
            IMetroContainerControl metroContainerControl = e.AssociatedWindow as IMetroContainerControl;

            if (metroContainerControl != null && metroContainerControl.StyleManager == null)
            {
                ((IMetroStyledComponent)this).InternalStyleManager = metroContainerControl.InternalStyleManager;
            }
            e.ToolTipSize = new Size(e.ToolTipSize.Width + 24, e.ToolTipSize.Height + 9);
        }
        private void ResetStyles(Control control)
        {
            // Skip container controls with a dedicated style manager component
            IMetroContainerControl container = control as IMetroContainerControl;

            if (container != null && container.StyleManager != null)
            {
                return;
            }

            IMetroStyledComponent styledComponent = control as IMetroStyledComponent;

            if (styledComponent != null)
            {
                var propc     = TypeDescriptor.GetProperties(control);
                var propTheme = propc.Find(MetroStyleManager.THEME_PROPERTY_NAME, false);
                if (propTheme != null && propTheme.CanResetValue(control))
                {
                    propTheme.ResetValue(control);
                }
                var propStyle = propc.Find(MetroStyleManager.STYLE_PROPERTY_NAME, true);
                if (propStyle != null && propStyle.CanResetValue(control))
                {
                    propStyle.ResetValue(control);
                }
            }

            if (control.ContextMenuStrip != null)
            {
                ResetStyles(control.ContextMenuStrip);
            }

            // descend into tab pages
            TabControl tabControl = control as TabControl;

            if (tabControl != null)
            {
                foreach (TabPage tp in tabControl.TabPages)
                {
                    ResetStyles(tp);
                }
            }

            // descend into child controls
            if (control.Controls != null)
            {
                foreach (Control child in control.Controls)
                {
                    ResetStyles(child);
                }
            }
        }
Пример #3
0
        private void MetroToolTip_Popup(object sender, PopupEventArgs e)
        {
            // only link to the windows internal style-manager if it deosn't expose a style manager component
            // (with a style manager component, the style manager will update us automatically)
            IMetroContainerControl styledWindow = e.AssociatedWindow as IMetroContainerControl;

            if (styledWindow != null && styledWindow.StyleManager == null)
            {
                ((IMetroStyledComponent)this).InternalStyleManager = styledWindow.InternalStyleManager;
            }

            e.ToolTipSize = new Size(e.ToolTipSize.Width + 24, e.ToolTipSize.Height + 9);
        }
Пример #4
0
        private void UpdateControl(Control control)
        {
            if (control == null)
            {
                return;
            }

            // If a container control is exposing a Style Manager, we link to it
            // but do not access the container's children.
            IMetroContainerControl container = control as IMetroContainerControl;

            if (container != null && container.StyleManager != null && !ReferenceEquals(this, container.StyleManager))
            {
                ((IMetroStyledComponent)container.StyleManager).InternalStyleManager = this;
                return;
            }

            // Link to metro controls
            IMetroStyledComponent styledComponent = control as IMetroStyledComponent;

            if (styledComponent != null)
            {
                styledComponent.InternalStyleManager = this;
            }

            if (control.ContextMenuStrip != null)
            {
                UpdateControl(control.ContextMenuStrip);
            }

            // descend into tab pages
            TabControl tabControl = control as TabControl;

            if (tabControl != null)
            {
                foreach (TabPage tp in tabControl.TabPages)
                {
                    UpdateControl(tp);
                }
            }

            // descend into child controls
            if (control.Controls != null)
            {
                foreach (Control child in control.Controls)
                {
                    UpdateControl(child);
                }
            }
        }
Пример #5
0
        public static MetroStyleManager GetNewManager(IMetroContainerControl owner)
        {
            if (_DefaultStyleManager == null)
            {
                _DefaultStyleManager = new MetroStyleManager();
                _DefaultStyleManager.Style = MetroFramework.MetroColorStyle.Green;
                _DefaultStyleManager.Theme = MetroFramework.MetroThemeStyle.Dark;
            }

            MetroStyleManager newManager = new MetroStyleManager();
            newManager.Style = _DefaultStyleManager.Style;
            newManager.Theme = _DefaultStyleManager.Theme;
            newManager.Owner = owner;

            _Managers.Add(owner, newManager);

            return newManager;
        }
Пример #6
0
        // Token: 0x0600009F RID: 159 RVA: 0x00003E2C File Offset: 0x0000202C
        private void UpdateControl(Control control)
        {
            if (control == null)
            {
                return;
            }
            IMetroContainerControl metroContainerControl = control as IMetroContainerControl;

            if (metroContainerControl != null && metroContainerControl.StyleManager != null && !object.ReferenceEquals(this, metroContainerControl.StyleManager))
            {
                ((IMetroStyledComponent)metroContainerControl.StyleManager).InternalStyleManager = this;
                return;
            }
            IMetroStyledComponent metroStyledComponent = control as IMetroStyledComponent;

            if (metroStyledComponent != null)
            {
                metroStyledComponent.InternalStyleManager = this;
            }
            if (control.ContextMenuStrip != null)
            {
                this.UpdateControl(control.ContextMenuStrip);
            }
            TabControl tabControl = control as TabControl;

            if (tabControl != null)
            {
                foreach (object obj in tabControl.TabPages)
                {
                    TabPage control2 = (TabPage)obj;
                    this.UpdateControl(control2);
                }
            }
            if (control.Controls != null)
            {
                foreach (object obj2 in control.Controls)
                {
                    Control control3 = (Control)obj2;
                    this.UpdateControl(control3);
                }
            }
        }
Пример #7
0
        private void ResetStyles(MetroStyleManager styleManager, Control control)
        {
            // Skip container controls with a dedicated style manager component
            IMetroContainerControl container = control as IMetroContainerControl;

            if (container != null && !ReferenceEquals(styleManager, container.StyleManager))
            {
                return;
            }

            if (control is IMetroStyledComponent)
            {
                ResetProperty(control, MetroStyleManager.THEME_PROPERTY_NAME, MetroStyleManager.AMBIENT_VALUE);
                ResetProperty(control, MetroStyleManager.STYLE_PROPERTY_NAME, MetroStyleManager.AMBIENT_VALUE);
            }

            if (control.ContextMenuStrip != null)
            {
                ResetStyles(styleManager, control.ContextMenuStrip);
            }

            // descend into tab pages
            TabControl tabControl = control as TabControl;

            if (tabControl != null)
            {
                foreach (TabPage tp in tabControl.TabPages)
                {
                    ResetStyles(styleManager, tp);
                }
            }

            // descend into child controls
            if (control.Controls != null)
            {
                foreach (Control child in control.Controls)
                {
                    ResetStyles(styleManager, child);
                }
            }
        }