예제 #1
0
        /// <summary>
        /// Saves the current instance's properties to a file.
        /// </summary>
        /// <param name="path">The file to save to.</param>
        public void Save(string path)
        {
            XmlWriter objFile = XmlWriter.Create(path);

            objFile.WriteStartDocument();
            objFile.WriteStartElement("looknfeel");
            objFile.WriteElementString("backgroundColor", background.ToString());
            objFile.WriteElementString("textColor", foreground.ToString());
            objFile.WriteElementString("buttonStyle", buttonStyle.ToString());
            objFile.WriteElementString("font", font.ToString());
            objFile.WriteStartElement("icons");
            objFile.WriteEndElement();
            objFile.WriteEndElement();
            objFile.WriteEndDocument();
            objFile.Close();
            objFile.Dispose();
        }
 //***************************************************************************
 // Static Methods
 // 
 public static void SetAllFlatStyles(Control.ControlCollection controls, FlatStyle value)
 {
     foreach (Control cn in controls)
     {
         Type cnType = cn.GetType();
         //System.Reflection.PropertyInfo pi = cnType.GetProperty("FlatStyle");
         System.Reflection.MemberInfo[] pi = cnType.FindMembers(System.Reflection.MemberTypes.Property, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, System.Type.FilterNameIgnoreCase, "FlatStyle");
         if (pi != null && pi.Length > 0)
         {
             if (cnType.FullName != "RainstormStudios.Controls.AdvancedButton")
                 ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, value, null);
             else if (cnType.FullName == "RainstormStudios.Controls.AdvancedButton")
             {
                 try
                 {
                     AdvancedButton.AdvButtonStyle btnStyle = (AdvancedButton.AdvButtonStyle)Enum.Parse(typeof(AdvancedButton.AdvButtonStyle), value.ToString());
                     ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, btnStyle, null);
                 }
                 finally { }
             }
         }
         if (cn.Controls.Count > 0)
             RsUserControlBase.SetAllFlatStyles(cn.Controls, value);
     }
 }
예제 #3
0
 //***************************************************************************
 // Static Methods
 //
 public static void SetAllFlatStyles(Control.ControlCollection controls, FlatStyle value)
 {
     foreach (Control cn in controls)
     {
         Type cnType = cn.GetType();
         //System.Reflection.PropertyInfo pi = cnType.GetProperty("FlatStyle");
         System.Reflection.MemberInfo[] pi = cnType.FindMembers(System.Reflection.MemberTypes.Property, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, System.Type.FilterNameIgnoreCase, "FlatStyle");
         if (pi != null && pi.Length > 0)
         {
             if (cnType.FullName != "RainstormStudios.Controls.AdvancedButton")
             {
                 ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, value, null);
             }
             else if (cnType.FullName == "RainstormStudios.Controls.AdvancedButton")
             {
                 try
                 {
                     AdvancedButton.AdvButtonStyle btnStyle = (AdvancedButton.AdvButtonStyle)Enum.Parse(typeof(AdvancedButton.AdvButtonStyle), value.ToString());
                     ((System.Reflection.PropertyInfo)pi[0]).SetValue(cn, btnStyle, null);
                 }
                 finally { }
             }
         }
         if (cn.Controls.Count > 0)
         {
             RsUserControlBase.SetAllFlatStyles(cn.Controls, value);
         }
     }
 }