Articles in this section
Category / Section

How to configure text in WinForms SyntaxEditor through configurationa dialog window?

2 mins read

Show configuration dialog

In WinForms EditControl, 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 


Conclusion

I hope you enjoyed learning about how to configure text in WinForms SyntaxEditor (EditControl) through configurationa dialog window.

You can refer to our WinForms EditControl feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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