Exemplo n.º 1
0
        /// <summary>
        /// Dialog to get preferences from user
        /// </summary>

        public static void Edit()
        {
            if (Instance == null)
            {
                Instance = new PreferencesDialog();
            }
            Instance.Setup();
            DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm);

            return;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set the default look and feel
        /// </summary>
        /// <param name="lookAndFeelName"></param>

        public static void SetLookAndFeel(
            string lookAndFeelName)
        {
            if (Instance == null)
            {
                Instance = new PreferencesDialog();
            }

            Color mainMenuFontColor = LookAndFeelMx.SetLookAndFeel(lookAndFeelName, Instance.DefaultLookAndFeel.LookAndFeel);

            int mainMenuLeft = 45;

            SessionManager sm = SessionManager.Instance;

            if (sm != null && sm.RibbonCtl != null)
            {
                RibbonControl  ribbon = sm.RibbonCtl;
                RibbonViewInfo vi     = ribbon.ViewInfo;

                ribbon.Minimized = true; // be sure minimized
                if (MobiusIcon == null)
                {
                    MobiusIcon = ribbon.ApplicationIcon;
                }
                if (QuickSearchImageIndex < 0)
                {
                    QuickSearchImageIndex = sm.QuickSearchControl.ImageIndex;
                }

                if (Lex.Contains(lookAndFeelName, "Office 2010"))
                // || Lex.Contains(lookAndFeelName, "Windows 7"))
                { // use new style ribbon
                    ribbon.RibbonStyle               = RibbonControlStyle.Office2010;
                    ribbon.ShowPageHeadersMode       = ShowPageHeadersMode.Hide;
                    ribbon.ApplicationIcon           = null; // don't show Mobius icon on application button
                    ribbon.ApplicationButtonText     = "";
                    sm.QuickSearchControl.ImageIndex = -1;
                }

                else // Office 2007 ribbon
                {
                    ribbon.RibbonStyle               = RibbonControlStyle.Office2007;
                    ribbon.ApplicationIcon           = MobiusIcon;
                    sm.QuickSearchControl.ImageIndex = QuickSearchImageIndex;
                }

                // Obsolete
                //if (sm != null && sm.MainMenuControl != null && sm.ShellForm != null)
                //{
                //	MainMenuControl menu = sm.MainMenuControl;

                //	if (ribbon.RibbonStyle == RibbonControlStyle.Office2010)
                //		mainMenuLeft += 14;

                //	menu.Left = mainMenuLeft;

                //	SetMainMenuTopPosition();

                //	menu.SetFontColor(mainMenuFontColor);
                //}
            }

            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
            Application.DoEvents(); // repaint

            return;

            /// Get skin element color
            //DevExpress.Skins.Skin currentSkin = DevExpress.Skins.CommonSkins.GetSkin(PreferencesDialog.Instance.DefaultLookAndFeel.LookAndFeel);
            //string elementName = DevExpress.Skins.CommonSkins.SkinTextBorder;
            //DevExpress.Skins.SkinElement element = currentSkin[elementName];
            //QueryDescDivider.BackColor = element.Border.All;
        }