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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the font settings of the Formats in WinForms SyntaxEditor (EditControl) programmatically?

Platform: WinForms |
Control: EditControl

Font settings

It is possible to change the font settings of the Formats in the EditControl programmatically using the ISnippetFormat.Font property as shown in code snippets below.


private void ApplyFont()
   SnippetFormat format;
   Config c=this.editControl1.Configurator;
   IConfigLanguage configlang=c.GetLanguage("cs");
   ConfigLanguage configlanguage=configlang as ConfigLanguage;
   for( int i = 0, len = configlanguage.Count; i < len; i++ )
      format = configlanguage[ i ] as ISnippetFormat;
      format.Font =new Font(this.newfont,fontstyle);



Private Sub ApplyFont()
    Dim format As Syncfusion.Windows.Forms.Edit.Interfaces.ISnippetFormat
    Dim c As Syncfusion.Windows.Forms.Edit.Implementation.Config.Config =  Me.EditControl1.Configurator
    Dim configlang As Syncfusion.Windows.Forms.Edit.Interfaces.IConfigLanguage = c.GetLanguage("vb")
    Dim configlanguage As Syncfusion.Windows.Forms.Edit.Implementation.Config.ConfigLanguage = CType(IIf(TypeOf configlang Is ConfigLanguage, configlang, Nothing), ConfigLanguage)
    Dim i As Integer = 0
    Dim len As Integer = configlanguage.Count
    Do While i < len
         format = CType(IIf(TypeOf configlanguage(i) Is Syncfusion.Windows.Forms.Edit.Interfaces.ISnippetFormat, configlanguage(i), Nothing), ISnippetFormat)
         format.Font = New Drawing.Font(Me.newfont, fontstyle)
         i += 1
     End Sub
End Class


Reference link: https://help.syncfusion.com/windowsforms/syntax-editor/syntax-highlighting#configure-custom-language-using-code

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment
Henry Drews
Sep 06, 2014
This is an excellent example, but could you also show how to save those changes to the configuration so that the next time it is called it will already have those changes applied. Reply
Ashwini Jaya Preetha Durai Samy [Syncfusion]
Oct 14, 2014
Hi Henry, Thank you for your update, We would like to let you know that while changing the EditControl settings at run time, the settings will not be saved. Only the default settings will be applied while loading the EditControl next time and it will be needed to handle end user level serialization to achieve this requirement. Regards, Ashwini
Dec 18, 2020


_strong text


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