We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I perform VS.NET like underlining for offending code in the EditControl ?


EditControl supports VS.NET like wavy underlining of text. The wavy underlines can also have custom color and double lines. Please refer to the code snippets and sample application attached below that illustrates how you could implement the offending code underlining feature of VS.NET in EditControl.


// Starting offset converted to virtual point

Point startVirtualPoint = this.editControl1.ConvertOffsetToVirtualPosition(startOffsetValue);

// Ending offset converted to virtual point

Point endVirtualPoint = this.editControl1.ConvertOffsetToVirtualPosition(endOffsetValue);

// Converting the VirtualPoints to ParsePoints

ParsePoint startParsePoint = new ParsePoint(startVirtualPoint.Y, startVirtualPoint.X, 0);

ParsePoint endParsePoint = new ParsePoint(endVirtualPoint.Y, endVirtualPoint.X, 0);

// Creating the associated CoordinatePoints that indicate the text range

CoordinatePoint startCoordinatePoint = new CoordinatePoint((ILexemParser)this.editControl1.Parser, startParsePoint, startVirtualPoint.Y, startVirtualPoint.X, true);

CoordinatePoint endCoordinatePoint = new CoordinatePoint((ILexemParser)this.editControl1.Parser, endParsePoint, endVirtualPoint.Y, endVirtualPoint.X, true);

ISnippetFormat format = editControl1.RegisterUnderlineFormat(Color.Red, UnderlineStyle.Wave, UnderlineWeight.Thick);

this.editControl1.SetUnderline (startCoordinatePoint, endCoordinatePoint, format);


' Starting offset converted to virtual point

Dim startVirtualPoint As Point = Me.editControl1.ConvertOffsetToVirtualPosition(startOffsetValue)

' Ending offset converted to virtual point

Dim endVirtualPoint As Point = Me.editControl1.ConvertOffsetToVirtualPosition(endOffsetValue)

' Converting the VirtualPoints to ParsePoints

Dim startParsePoint As New ParsePoint(startVirtualPoint.Y, startVirtualPoint.X, 0)

Dim endParsePoint As New ParsePoint(endVirtualPoint.Y, endVirtualPoint.X, 0)

' Creating the associated CoordinatePoints that indicate the text range

Dim startCoordinatePoint As New CoordinatePoint(CType(Me.editControl1.Parser, ILexemParser), startParsePoint, startVirtualPoint.Y, startVirtualPoint.X, True)

Dim endCoordinatePoint As New CoordinatePoint(CType(Me.editControl1.Parser, ILexemParser), endParsePoint, endVirtualPoint.Y, endVirtualPoint.X, True)

Dim format As ISnippetFormat = editControl1.RegisterUnderlineFormat(Color.Red, UnderlineStyle.Wave, UnderlineWeight.Thick)

Me.editControl1.SetUnderline(startCoordinatePoint, endCoordinatePoint, format)

Article ID: Published Date: Last Revised Date: Platform: Control:
321 04/30/2011 07/10/2014 WinForms EditControl
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon