Page 1 of 1

How to get Color Property of UltraLabel

Posted: Tue Jun 28, 2016 12:40 pm
by sukhmeet032795
Hi,

We are using Infragistics in our Application. Now we have multiple UltraLabels in our application i.e Infragistics.Win.Misc.Ultralabel. These labels have some Background color which is of certain significance. I want to know the Background Color which each Ultralabel represents. I have googled and gone through the forum, but could not find anything much of significance.

I can't upload the screenshot as it is against company policies.

How can i achieve this?

Re: How to get Color Property of UltraLabel

Posted: Tue Jun 28, 2016 12:46 pm
by odklizec
Hi,

Now this is definitely something you will have to do via InvokeRemotely, as described here:
http://www.ranorex.com/forum/finding-th ... html#p3622

Re: How to get Color Property of UltraLabel

Posted: Tue Jun 28, 2016 1:07 pm
by sukhmeet032795
Hi,

It did not work for me. I got the following error.

Action 'invokeremotely' failed on element '{Unknown:ultraPanel2}'.
Object reference not set to an instance of an object.

here is my code ->

Code: Select all

Ranorex.Control elementUltraGrid1 = new Ranorex.Control("/form[@controlname='PranaMain']/element[@controlname='ultraPanel2']");

bool backColor = (bool)elementUltraGrid1.InvokeRemotely(
            	delegate(System.Windows.Forms.Control control, object input){
            		
            		Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid = (control as Infragistics.Win.UltraWinGrid.UltraGrid);
            		Report.Info(ultraGrid.ActiveCell.Appearance.BackColor.ToString());
				    return true;  
            	});

Re: How to get Color Property of UltraLabel

Posted: Wed Jun 29, 2016 11:56 am
by odklizec
Hi,

In your firts post, you mentioned you are using Infragistics.Win.Misc.Ultralabel but in your code you are using Infragistics.Win.UltraWinGrid.UltraGrid ? My guess is that this is the cause of the error? But as I mentioned, I've never used InvokeRemotely before ;)