Current Line Highlight without Focus

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Ken Howe
Version: 4.0.0282
Avatar
Hi,

I have 2 Editors side by side and I want to highlight a line in both to the user. I'm using the CurrentLineHighlightingVisible = true which works great but when I move focus out of the control the highlight disappears.

How can I make the highlighting stay even if there is no user focus in the control?

Thanks
-- Ken

Comments (5)

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

Sorry but current line highlighting is only intended to show the line while the editor is focused.

You may be better off using the DocumentLine.BackColor property on the line you wish to highlight.

Or alternatively create a renderer that inherits VisualStudio2005SyntaxEditorRenderer, set it to the SyntaxEditor.Renderer property and override its DrawTextAreaBackground method to draw a rectangle over the bounds of the line to highlight, maybe whichever line contains the caret.


Actipro Software Support

Posted 14 years ago by Ken Howe
Avatar
Hi,

Thanks for the response, one of the things I really liked about using the CurrentLineHighlightingVisible property was I could set the highlight color to a value and use the transparency setting so when the row was highlighted it blended the current row background color with the highlight color.

I already have a LineIndicator which I use to put glyphs into the left hand column and I set the DocumentLine[].BackColor to various highlighting colors specific to my application.

With your proposals:

Using the DocumentLine I can set and track the color easily, however I loose the blended effect of my existing backgrounds already set.

What would I override to get a blended line if I inherit VisualStudio2005SyntaxEditorRenderer to allow me to blend the back color over the top of the current background color?

Cheers,
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ken,

Actually the line's BackColor gets applied immediately before the current line highlight when rendering. So if you use a semi-transparent color, it should have the same effect.


Actipro Software Support

Posted 14 years ago by Ken Howe
Avatar
In my application I already set the BackColor of each line before the user gets to play with the window, its currently non-editable text being displayed.

When they click on a line I want to highlight it. I could grab the current line color and restore it back when the user clicks on another row but what I want to achieve visually is the effect of blending the 2 colors together like the current highlight does.

So if I have a bunch of red rows and a silver highlight with 50% transparency I get a silvery red row on the one the user clicks on it which looks different to the next row down which is still red.

I'm not sure this is explaining too well, if its no good I'll post a piccy of what I am after.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ken,

Check out our UIColor object in the Shared Library. It has some static methods I believe that let you mix colors. So you could use that to mix your red and silver together and use the resulting color. Then restore the original color later when appropriate.


Actipro Software Support

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.