Articles in this section
Category / Section

How to configure Visual Studio-like breakpoint in Windows Forms SyntaxEditor

1 min read

How to configure Visual Studio like Breakpoint in Windows Forms SyntaxEditor?

 

By default, the EditControl has no option to insert the breakpoint like Microsoft Visual Studio. But, you can configure the breakpoint using CustomBookMark support. The following code example demonstrates how to configure breakpoint using CustomBookMark in the EditControl.

C#

/// <summary>
/// Holds a collection of custom bookmarks
/// </summary>
private List<int> customBookmarkCollection;
 
/// <summary>
/// To draw breakpoint
/// </summary>
private void DrawBreakPoint(object sender, BookmarkPaintEventArgs e)
{
     SolidBrush brush = new SolidBrush(breakpointcolor);
     e.Graphics.FillEllipse(brush, e.ClipRectangle.X, e.ClipRectangle.Y - 2, e.ClipRectangle.Width + 1, e.ClipRectangle.Height);
}
 
// To add breakpoint
this.editControl1.SetCustomBookmark(this.editControl1.CurrentLine, new BookmarkPaintEventHandler(DrawBreakPoint));
 
// To remove breakpoint
this.editControl1.RemoveCustomBookmark(this.editControl1.CurrentLine, new BookmarkPaintEventHandler(DrawBreakPoint));

 

VB

''' <summary>

''' Holds a collection of custom bookmarks

''' </summary>

Private customBookmarkCollection As List(Of Integer)

 

''' <summary>

''' To draw breakpoint

''' </summary>

Private Sub DrawBreakPoint(ByVal sender As Object, ByVal e As BookmarkPaintEventArgs)

 Dim brush As New SolidBrush(breakpointcolor)

 e.Graphics.FillEllipse(brush, e.ClipRectangle.X, e.ClipRectangle.Y - 2, e.ClipRectangle.Width + 1, e.ClipRectangle.Height)

End Sub

 

' To add breakpoint

Me.editControl1.SetCustomBookmark(Me.editControl1.CurrentLine, New BookmarkPaintEventHandler(AddressOf DrawBreakPoint))

 

' To remove breakpoint

Me.editControl1.RemoveCustomBookmark(Me.editControl1.CurrentLine, New BookmarkPaintEventHandler(AddressOf DrawBreakPoint))

 

Added breakpoint in EditControl

 

Samples

C#: https://www.syncfusion.com/downloads/support/directtrac/217530/ze/CSharpExample30980849

VB: https://www.syncfusion.com/downloads/support/directtrac/217530/ze/VB_Example1128006783

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied