How to retreive the BackColor in ARGB format

The following statement returns Color [Control]. How do I get the actual color from it?
SwfWindow("Hedge Fund Collateral").SwfObject("m_dealSimpleGrid").Object.CurrentCell.Renderer.StyleInfo.BackColor

Thanks & Regards,
Soloman


7 Replies

RC Rajadurai C Syncfusion Team February 13, 2009 11:55 AM UTC

Hi Soloman,

Thanks for your interest in Syncfusion products.

Sorry for the long delay in responding to you.

Please refer to the following code that retrieves the color in ARGB format from the color object.

Color c = this.gridControl1.CurrentCell.Renderer.StyleInfo.BackColor;
int a = (int)c.A;
int r = (int)c.R;
int g = (int)c.G;
int b = (int)c.B;
Console.WriteLine(a.ToString ()+","+r.ToString()+","+g.ToString ()+","+b.ToString ());


Regards,
Rajadurai



AD Administrator Syncfusion Team February 16, 2009 08:19 AM UTC

Hi Rajadurai,
Thanks for your response.I guess, my request was not in detail enough. My requirement is to get the cell background color of SF Grid. I am using QTP 9.2 with Sync fusion Test add-in (Syncfusion Essential TestStudio -6.2.0.40). I believe, I won't be able to use the code you provided, in QTP. Let me know, my requirement can be accomplished in any way.
Thanks & Regards,
Soloman



NR Nirmal Raja Syncfusion Team February 19, 2009 03:37 PM UTC

Hi Soloman,

I have added a method called GetCellBackColor in the source of GridControl custom assembly.
Please download from the following location and replace it in the bin folder in your installed location of EssentialTestStudio:
GridControl.zip

And then try using the below code to retrieve the back color of a particular cell:
SwfWindow("GridControl").SwfObject("gridControl1").GetCellBackColor 11,6

Let me know if you have any queries.

Regards,
Nirmal




AD Administrator Syncfusion Team February 20, 2009 03:15 PM UTC

Hi Nirmal..
I am not able to retrieve the attachement..Is there any issue with this attachment. Could you please check it out?
Thanks & Regards,
Soloman



NR Nirmal Raja Syncfusion Team February 26, 2009 01:45 AM UTC

Hi Soloman,

Sorry for the inconvenience.

Please try the below link, and let me know if it helps:
GridControl.zip

Regards,
Nirmal



AD Administrator Syncfusion Team February 27, 2009 09:17 AM UTC

Hi Nirmal,
Thank you for your response. I was able to download the DLL and I replaced Grid.dll in my machine with this file. When I executed the below scripts, I still get the "Color[Control]" as the background color.
If I don't set the cell first, I get "Color[Window]"

SwfWindow("Hedge Fund Collateral").SwfObject("m_dealSimpleGrid").SetCurrentCell 4,0
ret= SwfWindow("Hedge Fund Collateral").SwfObject("m_dealSimpleGrid").GetCellBackColor (4,0)
msgbox ret

Thanks in advance
Soloman




VI vidhya December 19, 2011 08:12 AM UTC

Hi,

I downloaded the new dll and tried to fetch the Cell fore color using GetCellForeColor method. But it did not work. Please help.

Below is the statement used-
Color = SwfWindow("WindowName").SwfObject("ObjectName").GetCellForeColor(1,1)

Thanks in advance.




Loader.
Up arrow icon