SpanIndicator and DrawMarks in v4.0

SyntaxEditor for Windows Forms Forum

Posted 13 years ago by Daniel Amesberger
Avatar
I'm using a SpanIndicator-derived class and override DrawMarks to draw the background. I use a gradient fill with alpha so ApplyHighlightingStyleColors and ApplyHighlightingStyleAdornments is not sufficient.
In v3.1 the bounds parameter of DrawMarks had the rectangle of the span, now in v4.0 the bounds rectangle covers the full line, not only the span. Is there another way of retrieving the bounds of the SpanIndicator or is this a bug?

Regards,
Daniel

Comments (5)

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

Hmmm... it is probably a bug. Here's a question... now that you are implementing it, what would you like to see in terms of parameters. Now is the time to implement changes if you have anything else you'd like added/changed.


Actipro Software Support

Posted 13 years ago by Daniel Amesberger
Avatar
It would be nice to have overload to pass a System.Drawing.Brush to the HighlightingStyle class instead of the background color. With that, it would be possible to use a LinearGradientBrush. Internally I think you create a brush for the background color anyway. But I don't know if someone uses that except for me :-)
Another advantage is the use of alpha channels. In my application using v3.1 I use overlapping SpanIndicators with gradients and alpha, so I can visually see where one span ends and another begins even if they are overlapping. With a Brush, alphas are not a problem - the backColor of HighlightningStyle does not support alphas, I already tried to pass a Color.FromArgb(100, Color.Blue) and its completly opaque.
The DrawMarks parameters are ok, as far as I used them, just the bounds parameter should be fixed.

Besides that I think that I've found another issue. When I'm deleting a SpanIndicator by selecting the span and the character before the span and press backspace or del the DocumentIndicatorRemoved event is fired correctly. But when I just backspace until the SpanIndicator has a length of 0, and then press backspace one more time the DocumentIndicatorRemoved event is not fired. In v3.1 it did fire in this case, as far as I remember, because the SpanIndicator should be removed from the collection. I already checked my ExpandOnBoundaries override, it returns false, so there should be no expansion.

Regards,
Daniel
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
v4.0 should be supporting alpha background colors. It's one of the new features. Any HighlightingStyle or even the Selection can have a semi-transparent backcolor. It's working for me... do this:

In the Indicators QuickStart, change to this code for the CustomIndicator:
/// <summary>
/// Applies the foreground and background colors of the span indicator to the specified <see cref="HighlightingStyleResolver"/>.
/// </summary>
/// <param name="resolver">The <see cref="HighlightingStyleResolver"/> to modify.</param>
protected override void ApplyHighlightingStyleColors(HighlightingStyleResolver resolver) {
    resolver.SetBackColor(Color.FromArgb(200, Color.Thistle));
    resolver.SetForeColor(Color.DarkMagenta);
}
Then run the QuickStart, highlight some text that overlaps the existing custom indicator and click the Add Breakpoint button. You'll see it being semi-transparent over the added breakpoint.

I'll mark down the indicator event issue as a bug.


Actipro Software Support

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
DrawMarks is now fixed for the next release. It also adds a displayLineIndex parameter.


Actipro Software Support

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

For the DocumentIndicatorRemoved event issue, it seems to be working for me. I uncommented the line in MainForm.editor_DocumentIndicatorRemoved to write a message whenever an indicator is removed. I select a range of text and click the indicator margin to add a breakpoint. Then I delete text various ways and the event fires whenever the indicator disappears. Can you tell me how to repro the issue?


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.