public EditorFontAndColors()
        {
            FontFamily         = "Consolas";
            FontSize           = 10.0f;
            FontBold           = false;
            ForeColor          = Color.Black;
            BackColor          = Color.White;
            HighlightFontBold  = false;
            HighlightForeColor = Color.White;
            HighlightBackColor = Color.Blue;

            try {
                var dte   = (EnvDTE.DTE)IndentGuidePackage.GetGlobalService(typeof(EnvDTE.DTE));
                var props = dte.Properties["FontsAndColors", "TextEditor"];

                var fac = (EnvDTE.FontsAndColorsItems)props.Item("FontsAndColorsItems").Object;

                var colors = (EnvDTE.ColorableItems)fac.Item("Plain Text");

                FontFamily = props.Item("FontFamily").Value.ToString();
                FontSize   = (float)(short)props.Item("FontSize").Value;
                FontBold   = colors.Bold;
                ForeColor  = ColorTranslator.FromOle((int)colors.Foreground);
                BackColor  = ColorTranslator.FromOle((int)colors.Background);

                colors = (EnvDTE.ColorableItems)fac.Item("Selected Text");

                HighlightFontBold  = colors.Bold;
                HighlightForeColor = ColorTranslator.FromOle((int)colors.Foreground);
                HighlightBackColor = ColorTranslator.FromOle((int)colors.Background);
            } catch (Exception ex) {
                Trace.WriteLine("Error loading text editor font and colors");
                Trace.WriteLine(ex.ToString());
            }
        }
Esempio n. 2
0
 public IndentGuideService(IndentGuidePackage package)
 {
     _Package = package;
 }
 public IndentGuideService(IndentGuidePackage package)
 {
     _Package = package;
 }