How to get the Highlighted Color ?

May 10, 2009 at 8: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,

Kannan

May 10, 2009 at 11:39 AM

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,

Kannan

Coordinator
May 25, 2009 at 6: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.

Coordinator
May 25, 2009 at 6: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 11:30 AM

Hi,

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

http://social.msdn.microsoft.com/Forums/en-US/windowsaccessibilityandautomation/thread/b9c29725-842a-40a6-8095-215d95250bbc

Thanks & Regards,

Kannan