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

Multiple backcolors in a edit control?

Thread ID:





129121 Feb 28,2017 01:47 PM UTC Mar 1,2017 10:39 AM UTC WinForms 1
Tags: EditControl
Brandon De Aguiar
Asked On February 28, 2017 01:47 PM UTC

Hey, I was just wondering if it's possible for the editcontrol to have multiple backcolors on at once? I'am trying to write a comparison program, so I want different colors highlighting lines to mean different things.

I was checking the appearance article in the site and it seems like it's possible but to my understanding it seems like there can only be one registered backcolor at once.

here's the site: The example I see with multiple registered back colors :


Thank you in advanced!

Kannan R [Syncfusion]
Replied On March 1, 2017 10:39 AM UTC

Hi Brandon, 
Thank you for contacting Syncfusion support.  
Yes, it is possible to have different Line Back color for each line and it can be achieved by defining required format for each line. Please make of code snippet in below for your reference.  
Code Snippet: [C#] 
            IBackgroundFormat format = this.editControl1.RegisterBackColorFormat(Color.Yellow, Color.Green, System.Drawing.Drawing2D.HatchStyle.NarrowHorizontal, true); 
            // Set the background for the entire line of text. 
            this.editControl1.SetLineBackColor(2, true, format); 
            format = this.editControl1.RegisterBackColorFormat(Color.Gray, Color.Red, System.Drawing.Drawing2D.HatchStyle.NarrowHorizontal, true); 
            this.editControl1.SetLineBackColor(5, true, format); 
            format = this.editControl1.RegisterBackColorFormat(Color.Green, Color.Green, System.Drawing.Drawing2D.HatchStyle.NarrowHorizontal, true); 
            this.editControl1.SetLineBackColor(7, true, format); 
We have also prepared sample for your reference and it can be downloaded from below location. 
Kindly check with the above solution and let us know if it is helpful.  


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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