Hi,
Which properties to use to change the backcolor and the forecolor of the editor?
Hi,
Which properties to use to change the backcolor and the forecolor of the editor?
Background color of the editor:
editor.Renderer.TextAreaBackColor = new SolidColorBackgroundFill(Color.White);
Forecolor and background color of the default syntax highlighting:
editor.Document.Language.HighlightingStyles.Add(new HighlightingStyle("DefaultStyle", null, Color.Black, Color.Transparent));
Thanks.
- Error 1 Property 'TextAreaBackColor' is 'ReadOnly'. Can't change te back color.
Changing the forecolor works great.
Hello the base SyntaxEditorRenderer class defines that property as read-only. But the implementation class we use (VisualStudio2005SyntaxEditorRenderer) has a setter. So cast it to that.
Example? I tried myeditor = VisualStudio2005SyntaxEditorRenderer.DefaultRenderer.TextAreaBackColor.FromArgb(255,64;64;64), but that seems to be wrong.
You need to cast the render instance of your editor. And don't forget the SolidColorBackgroundFill.
Fyi, I use a static renderer instance in my app. When I create an editor, I just assign my static instance to the editor. This way all editor instances are updated simultaniously.
var renderer = editor.Renderer as VisualStudio2005SyntaxEditorRenderer;
if (null != renderer)
{
renderer.TextAreaBackColor = new SolidColorBackgroundFill(Color.FromArgb(255,64;64;64));
}
[Modified 12 years ago]
Ah, like that. Thanks.
Please log in to a validated account to post comments.