How to highlight block of xml background only

SyntaxEditor Web Languages Add-on for Windows Forms Forum

Posted 12 years ago by NorthGates - NorthGates Systems
Version: 12.1.0311
Avatar

On Editor_Changed when there is no selection I collect the textrange of the current block of xml and change the background to a pale colour.

To accomplish this I use HighlightingStyleSpanIndicator but my problem is the nicely colored font of xml attributres are also changed.

//Control Init
editor.Document.SpanIndicatorLayers.Add(_spanIndicatorBlockHighlight);
_spanIndicatorBlockHighlightingStyle = new HighlightingStyle(_spanIndicatorBlockHighlightName, "res:Block Highlight Style", Color.Empty, SystemColors.Control);


// How can I only change the textrange background color without affecting forecolor?
void editor_SelectionChanged(object sender, SelectionEventArgs e)
{
    editor.Document.SpanIndicatorLayers[_spanIndicatorBlockHighlightName].Clear();

    if (e.Selection.IsZeroLength)
    {
        //highlight the block  
        editor.Document.SpanIndicatorLayers[_spanIndicatorBlockHighlightName].Add(
             new HighlightingStyleSpanIndicator("HSS", _spanIndicatorBlockHighlightingStyle), MyTextRange);
    }
}

[Modified 12 years ago]

Comments (1)

Answer - Posted 12 years ago by NorthGates - NorthGates Systems
Avatar

I tried to delete my post because it actually worked fine. Sorry!!

The latest build of this product (v25.1.0) was released 25 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.