Change backcolor and forecolor of editor

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Radjesh Klauke - X-impress
Version: 12.1.0300
Avatar

Hi,

Which properties to use to change the backcolor and the forecolor of the editor?

Comments (7)

Answer - Posted 12 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar

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));


Best regards, Tobias Lingemann.

Posted 12 years ago by Radjesh Klauke - X-impress
Avatar

Thanks.

Posted 12 years ago by Radjesh Klauke - X-impress
Avatar

- Error 1 Property 'TextAreaBackColor' is 'ReadOnly'. Can't change te back color.

Changing the forecolor works great.

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

Posted 12 years ago by Radjesh Klauke - X-impress
Avatar

Example? I tried myeditor = VisualStudio2005SyntaxEditorRenderer.DefaultRenderer.TextAreaBackColor.FromArgb(255,64;64;64), but that seems to be wrong.

Answer - Posted 12 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar

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]


Best regards, Tobias Lingemann.

Posted 12 years ago by Radjesh Klauke - X-impress
Avatar

Ah, like that. Thanks.

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.