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

Multiple backcolors in a edit control?

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 :

https://help.syncfusion.com/windowsforms/edit/appearance


Thank you in advanced!

1 Reply

KR Kannan R Syncfusion Team 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); 
 
 
 
Screenshot 
 
 
 
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.  
 
Regards 
Kannan 


Loader.
Up arrow icon