Posted 14 years ago by tobias weltner
Avatar
I am still trying to figure out how to create my own line indicators and got halfway stuck.

I inherited from spanindicators and was able to draw a glyph from an image list alright.
However, the squiggle line wasn't there I was used from the predefined line indicators.
So I inherited from squigglelineindicator as such:

Public Class cSyntaxErrorSpanIndicator
Inherits SquiggleLineIndicator



Sub New()
MyBase.new("myerr", 100, Color.Red) 'True, ActiproSoftware.SyntaxEditor.IndicatorMarks.Adornments)
End Sub

Protected Overrides Sub DrawGlyph(ByVal g As System.Drawing.Graphics, ByVal bounds As System.Drawing.Rectangle)
'MyBase.DrawGlyph(g, bounds)
Dim ico As Icon
ico = Icon.FromHandle(DirectCast(Form1.PIDImages.Images(2), Bitmap).GetHicon)
g.DrawIcon(ico, bounds)
End Sub
End Class

However, now the indicator does not draw the glyph anymore.
What am I doing wrong?? There does not seem to be a DrawGlyph...?!


[Modified at 08/01/2005 06:29 AM]

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The problem here is that SquiggleIndicator class is passing a constructor parameter to the base class SpanIndicator that says it doesn't have a glyph. That means that DrawGlyph is never called for SquiggleIndicators.

I'll post the code to draw a squiggle below so you can implement it in your indicator class:
protected internal override void DrawMarks(Graphics g, Rectangle bounds) {
    int x;
    int remainder = bounds.Width % 4;
    int squiggles = (int)(bounds.Width / 4);

    Pen pen = new Pen(color);
    for (int i = 0; i < squiggles; i++) {
        x = bounds.Left + i * 4;
                
        g.DrawLines(pen, new Point[] {
            new Point(x, bounds.Bottom - 2),
            new Point(x + 1, bounds.Bottom - 3),
            new Point(x + 3, bounds.Bottom - 1)
            });
    }
    pen.Dispose();
}


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.