This project is read-only.

How to get the Highlighted Color ?

May 10, 2009 at 9:33 AM

Dear All,


I’ve a tree and some of the tree nodes are highlighted by different color.


Is there any way to get the back color of the tree node ?


Similarly in grid also, nodes have different back color.


Is there any ways to get these colors ?


If so please let me know . . .


Thanks & Regards,


May 10, 2009 at 12:39 PM

Hi All,


I tried the below method to get the Background color of the text box.

But it always returns the color, R = 7, G = 0, B = 0. Anybody have a clue ?


      AutomationElement app = AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Form1"));


      AutomationElement textBox1 = app.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "textBox1"));


      NativeWindow nativeWindow1 = new NativeWindow(new IntPtr(textBox1.Current.NativeWindowHandle));


      COLORREF c1 = nativeWindow1.BackgroundColor;


Thanks & Regards,


May 25, 2009 at 7:52 AM

This method doesn't work. I shouldn't have let it be public. This background color feature doesn't work in white yet.

May 25, 2009 at 7:52 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 23, 2009 at 12:30 PM


I fixed this issue by a workground in the following link,

Thanks & Regards,