private TextEditorControl CreateTextBox()
{
var tb = new TextEditorControl();
tb.IsReadOnly = true;
// TODO: set proper highlighting.
tb.SetHighlighting("C#");
var high = (ICSharpCode.TextEditor.Document.DefaultHighlightingStrategy)tb.Document.HighlightingStrategy;
var def = high.Rules.First();
var delim = " ,().:\t\n\r";
for(int i = 0; i < def.Delimiters.Length; ++i)
def.Delimiters[i] = delim.Contains((char)i);
tb.ShowLineNumbers = false;
tb.ShowInvalidLines = false;
tb.ShowVRuler = false;
tb.ActiveTextAreaControl.TextArea.ToolTipRequest += OnToolTipRequest;
tb.ActiveTextAreaControl.TextArea.MouseMove += OnTextAreaMouseMove;
string[] tryFonts = new[] { "Consolas", "Lucida Console" };
foreach (var fontName in tryFonts)
{
tb.Font = new Font(fontName, 9, FontStyle.Regular);
if (tb.Font.Name == fontName) break;
}
if (!tryFonts.Contains(tb.Font.Name))
tb.Font = new Font(FontFamily.GenericMonospace, 9);
return tb;
}