Ejemplo n.º 1
0
        /// <summary>
        /// Invalidate appearance.
        /// </summary>
        public void InvalidateAppearance()
        {
            if (AppearanceName.Trim() == string.Empty)
            {
                return;
            }

            AppearanceList appearanceList = GetUsingAppearance();

            try
            {
                Appearance appearance = appearanceList[AppearanceName];
                UpdateAppearance(appearance);
            }
            catch { }
        }
Ejemplo n.º 2
0
        protected void UpdateAppearance(string appearanceName)
        {
            if (AppearanceName.Trim() == string.Empty)
            {
                return;
            }

            AppearanceList appearanceList = GetUsingAppearance();

            try
            {
                Appearance appearance = appearanceList[appearanceName];
                UpdateAppearance(appearance);
            }
            catch { }
        }
Ejemplo n.º 3
0
        private void UpdateAppearance(Appearance appearance)
        {
            if (appearance == null)
            {
                return;
            }

            FontStyle fontStyle = appearance.FontStyle;

            Font font = new Font(appearance.FontName, appearance.FontSize, fontStyle);

            this.Font      = font;
            this.BackColor = appearance.BackColor;
            this.ForeColor = appearance.ForeColor;

            this.Invalidate(false);
        }
Ejemplo n.º 4
0
        public static void Serialize(string filename, AppearanceList appearanceList)
        {
            DataTable dtView = CreateDataTableSchema();

            for (int i = 0; i < appearanceList.Count; i++)
            {
                Appearance apr = appearanceList[i];
                dtView.Rows.Add(
                    apr.Name,
                    apr.FontName,
                    apr.FontStyle,
                    apr.FontSize,
                    ConvertColorToString(apr.ForeColor),
                    ConvertColorToString(apr.BackColor)
                    );
            }

            dtView.WriteXml(filename, XmlWriteMode.IgnoreSchema);
        }
Ejemplo n.º 5
0
        private static AppearanceList ConvertDataTableToAppearanceList(DataTable dtView)
        {
            AppearanceList list = new AppearanceList();

            for (int i = 0; i < dtView.Rows.Count; i++)
            {
                Appearance apr = new Appearance(
                    dtView.Rows[i]["Name"].ToString(),
                    dtView.Rows[i]["FontName"].ToString(),
                    Convert.ToSingle(dtView.Rows[i]["FontSize"]),
                    ConvertStringToFontStyle(dtView.Rows[i]["FontStyle"].ToString()),
                    ConvertStringToColor(dtView.Rows[i]["ForeColor"].ToString()),
                    ConvertStringToColor(dtView.Rows[i]["BackColor"].ToString())
                    );

                list.Add(apr);
            }
            return(list);
        }