Category / Section
How to highlight the error line in Edit control?
1 min read
Edit control supports to highlight the error lines. It can be achieved using below functions,
RegisterUnderlineFormat: Used to set custom underline format. It contains the below parameter.
- Color: Used to set the underline custom color.
- UnderlineStyle: Used to set the Style of the underlining, like as Dash, DashDot, Dot, Solid, Wave.
- UnderlineWeight: Used to set the Weight of the underlining like as Bold, Double, Double Bold, Thin.
SetUnderline: Used to set the underline in specified text region.
RemoveUnderLine: Used to remove the underline in specified region.
The following code demonstrates same.
C#
ISnippetFormat format; format = editControl1.RegisterUnderlineFormat(Color.Red, Syncfusion.Windows.Forms.Edit.Enums.UnderlineStyle.Solid, Syncfusion.Windows.Forms.Edit.Enums.UnderlineWeight.Bold); // To draw underline this.editControl1.SetUnderline(this.editControl1.Selection.Top, this.editControl1.Selection.Bottom, format); // To remove underline this.editControl1.RemoveUnderline(this.editControl1.Selection.Top, this.editControl1.Selection.Bottom);
VB
ISnippetFormat format format = editControl1.RegisterUnderlineFormat(Color.Red, Syncfusion.Windows.Forms.Edit.Enums.UnderlineStyle.Solid, Syncfusion.Windows.Forms.Edit.Enums.UnderlineWeight.Bold) ' To draw underline Me.editControl1.SetUnderline(Me.editControl1.Selection.Top,Me.editControl1.Selection.Bottom, format) ' To remove the selection Me.editControl1.RemoveUnderline(Me.editControl1.Selection.Top,Me.editControl1.Selection.Bottom)
Screenshot