)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to configure text in WinForms SyntaxEditor (EditControl) through configuration dialog window?

Platform: WinForms |
Control: EditControl |
Published Date: March 31, 2016 |
Last Revised Date: December 11, 2019

Show configuration dialog

In Edit control, at runtime Syntax highlighting functionality can be customized by using class named “ConfigurationDialog” and Interface named “IConfig”.

 

Following code examples demonstrates the same.

C#

IConfigLanguage activeLang = this.editControl1.Parser.Formats as IConfigLanguage;
ConfigurationDialog editConfig = new ConfigurationDialog(this.editControl1.Configurator, activeLang);
//Display the EditControl configuration dialog
if (editConfig.ShowDialog(this) == DialogResult.OK && activeLang != null)
{
    IConfigLanguage newLang = editConfig.Configurator.KnownLanguageNames.Contains(activeLang.Language)?
editConfig.Configurator[activeLang.Language]: editConfig.Configurator.DefaultLanguage;
    if (newLang != null)
    {
          this.editControl1.Configurator = editConfig.Configurator;
          this.editControl1.ApplyConfiguration(newLang);
    }
 }

 

VB

Dim activeLang As IConfigLanguage = TryCast(Me.editControl1.Parser.Formats, IConfigLanguage)
Dim editConfig As New ConfigurationDialog(Me.editControl1.Configurator, activeLang)
'Display the EditControl configuration dialog
If editConfig.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK AndAlso activeLang IsNot Nothing Then
 Dim newLang As IConfigLanguage = If (editConfig.Configurator.KnownLanguageNames.Contains(activeLang.Language), editConfig.Configurator(activeLang.Language), editConfig.Configurator.DefaultLanguage)
 If newLang IsNot Nothing Then
  Me.editControl1.Configurator = editConfig.Configurator
  Me.editControl1.ApplyConfiguration(newLang)
 End If
End If

                             

Customize syntax highlighting in EditControl runtime with image

Figure 1. Customize Syntax highlighting in Edit control runtime with image.

Sample Links:

 

C#:How to customize Syntax highlighting in Edit control runtime C#

VB: How to customize Syntax highlighting in Edit control runtime VB

 

Reference link: https://help.syncfusion.com/windowsforms/syntax-editor/syntax-highlighting

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon