コード例 #1
0
        /// <summary>
        /// Gets a Color value specifying the background color of the page
        /// </summary>
        /// <returns></returns>
        public Color GetPageColor(out bool automatic, out bool black)
        {
            black = ApplicationManager.OfficeSetToBlackTheme();

            var color = Root.Element(Namespace + "PageSettings").Attribute("color")?.Value;

            if (string.IsNullOrEmpty(color) || color == "automatic")
            {
                automatic = true;
                return(Color.White);
            }

            automatic = false;

            try
            {
                return(ColorTranslator.FromHtml(color));
            }
            catch
            {
                return(ApplicationManager.OfficeSetToBlackTheme() ? Color.Black : Color.White);
            }
        }