public void Init()
        {
            Size s = TextRenderer.MeasureText("X", Font);

            CharWidth = s.Width;
            SetTabSpaces(4);
            SHC = SyntaxHighlightColors.Load();
            if (SHC == null)
            {
                SHC = SyntaxHighlightColors.GetDefault();
                SHC.Save();
            }
            UpdateColors();
        }
        public static SyntaxHighlightColors GetDefault()
        {
            SyntaxHighlightColors shc = new SyntaxHighlightColors();

            shc.Text    = Color.LightGray;
            shc.Symbol  = Color.Red;
            shc.Comment = Color.DarkGreen;
            shc.Keyword = Color.Lime;
            shc.Number  = Color.Yellow;
            shc.String  = Color.Cyan;
            shc.Global  = Color.Teal;

            return(shc);
        }
 public static SyntaxHighlightColors Load()
 {
     try
     {
         XmlSerializer         xml = new XmlSerializer(typeof(SyntaxHighlightColors));
         SyntaxHighlightColors shc = xml.Deserialize(File.OpenRead(Path.Combine(Globals.AppPath, "luasyntax.colors"))) as SyntaxHighlightColors;
         if (shc != null)
         {
             shc.PostLoad();
         }
         return(shc);
     }
     catch (Exception e)
     {
         //MessageBox.Show("Error : " + e.Message, "Syntax highlighting loading error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(null);
     }
 }