Exemplo n.º 1
0
        void barItemStyle_EditValueChanged(object sender, EventArgs e)
        {
            RibbonControlStyle style = (RibbonControlStyle)barItemStyle.EditValue;

            UpdateLookAndFeel(style);
            RibbonCol.RibbonStyle = style;

            try
            {
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.Load(XMLPath);
                System.Xml.XmlNodeList nodelist = doc.SelectSingleNode("SetSkin").ChildNodes;
                foreach (System.Xml.XmlNode node in nodelist)
                {
                    System.Xml.XmlElement xe = (System.Xml.XmlElement)node;//将子节点类型转换为XmlElement类型
                    if (xe.Name == "Stylestring")
                    {
                        xe.InnerText = style.ToString();
                    }
                }

                doc.Save(XMLPath);
            }
            catch (Exception ex)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        public static void LoadSkin(RibbonControl rc = null)
        {
            SkinTools sk = new SkinTools();

            sk.GetXmlSkin();

            if (rc != null && sk.defaultRbStyle != "")
            {
                RibbonControlStyle style = (RibbonControlStyle)Enum.Parse(typeof(RibbonControlStyle), sk.defaultRbStyle);
                rc.RibbonStyle = style;
            }

            UserLookAndFeel.Default.SetSkinStyle(sk.defaultSkinName);//设置主题样式
        }
Exemplo n.º 3
0
        private void biStyle_EditValueChanged(object sender, EventArgs e)
        {
            RibbonControlStyle style = (RibbonControlStyle)biStyle.EditValue;

            this.ribbon.RibbonStyle = style;
            if (style == RibbonControlStyle.Office2010 || style == RibbonControlStyle.Office2013)
            {
                //this.ribbon.ApplicationButtonDropDownControl = this.backstageViewControl1;
            }
            else
            {
                this.ribbon.ApplicationButtonDropDownControl = this.appMenu;
            }
            string skinName;

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DefaultWorkbench));
            switch (style)
            {
            case RibbonControlStyle.Default:
                skinName = "DevExpress Style";
                this.ribbon.ApplicationIcon = ((System.Drawing.Bitmap)(resources.GetObject("ribbon.ApplicationIcon")));
                break;

            case RibbonControlStyle.Office2007:
                skinName = "Office 2007 Blue";
                this.ribbon.ApplicationIcon = ((System.Drawing.Bitmap)(resources.GetObject("ribbon.ApplicationIcon")));
                break;

            case RibbonControlStyle.Office2013:
                skinName = "Office 2013";
                this.ribbon.ApplicationIcon = null;
                break;

            case RibbonControlStyle.Office2010:
            default:
                skinName = "Office 2010 Silver";
                this.ribbon.ApplicationIcon = null;
                break;
            }
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(skinName);
        }
Exemplo n.º 4
0
        void UpdateLookAndFeel(RibbonControlStyle style)
        {
            string skinName;

            switch (style)
            {
            case RibbonControlStyle.Default:
            case RibbonControlStyle.Office2007:
                skinName = "Office 2007 Blue";
                break;

            case RibbonControlStyle.Office2013:
                skinName = "Office 2013";
                break;

            case RibbonControlStyle.Office2010:
            case RibbonControlStyle.MacOffice:
            default:
                skinName = "Office 2010 Blue";
                break;
            }
            UserLookAndFeel.Default.SetSkinStyle(skinName);
        }