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.
Unfortunately, activation email could not send to your email. Please try again.

Multiple backcolors in a edit control?

Thread ID:

Created:

Updated:

Platform:

Replies:

129121 Feb 28,2017 08:47 AM Mar 1,2017 05:39 AM Windows Forms 1
loading
Tags: EditControl
Brandon De Aguiar
Asked On February 28, 2017 08:47 AM

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!

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

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 


CONFIRMATION

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.

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.

;