BackColor does not work

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Dong JIA
Version: 4.0.0248
Platform: .NET 2.0
Environment: Windows XP (32-bit)
Avatar
BackColor can not work. Is it obsolete? I can not find them from intellisense of VS, too. There is no any indication for this. But it really broke my code. :(

Code example:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ActiproSoftware.SyntaxEditor;
namespace TestforActipro
{
public partial class Form1 : Form
{
SyntaxEditor m_editor = new SyntaxEditor();
Button m_button = new Button();
public Form1()
{
InitializeComponent();
Controls.Add(m_button);
Controls.Add(m_editor);
m_button.Click += new EventHandler(button_Click);
}

void button_Click(object sender, EventArgs e)
{
m_editor.BackColor = Color.FromArgb(125, 125, 125);
m_editor.Refresh();
}
}
}

Comments (4)

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

In v4.0 we no longer use the BackColor property because all rendering is customizable via a renderer so I believe this is what you would want to do:
((VisualStudio2005SyntaxEditorRenderer)m_editor.RendererResolved).TextAreaBackgroundFill = new ActiproSoftware.Drawing.SolidColorBackgroundFill(Color.FromArgb(125, 125, 125));
The VisualStudio2005SyntaxEditorRenderer has a lot of customization properties for controlling pretty much how anything in the SyntaxEditor draws.


Actipro Software Support

Posted 12 years ago by Dong JIA
Avatar
you should announce it in your help file at least. It is really confused. :(

BTW, for backwards compatibility, I do not think it is a good idea to remove the backcolor property at all.

If we want to upgrade to new version to enjoy your new features, I must do a lot of works to modify my code. And there are some traps like "BackColor". Frankly to say, I doubt whether it is a right decision to upgrade to your new version now. :(
Posted 12 years ago by Kasper
Avatar
I can only recommend that you upgrade to version 4.0 - it's absolutely amazing, and so is the support, so in case you actually run into any trouble, you're never far away from qualified help :)

Anyway, I was trying to accomplish the same as you, but I ran into a slight problem. I wish to apply the same background color to the space between the linenumbermargin and the text area, but I can't seem to be able to do so. I have tried pretty much every option in the renderer, but it remains white, as seen on this image:

http://img149.imageshack.us/img149/5372/syntaxeditormarginor5.png

How do I apply the same color to the white space on the image? :)
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Sorry but we did have to make certain breaking changes from v3.1 to v4.0 in order to make some major new features possible. In the Readme's Release History, every change is documented like this one:
"The BackColor property will no longer set the background color of the editor since that is now controlled in the renderer used by the SyntaxEditor."

We took very special care to ensure that every change is described in detail in the Release History and also made a conversion help topic to cover the more high level concepts.

The renderer now draws the SyntaxEditor control completely so all rendering related properies are on there. It doesn't limit you to a single color for backgrounds. You could even do a gradient if you'd like using the v4.0 code.

Kasper, that is called the Selection margin so you can change the properties for that to change its background color.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.