Validating icon of titlebar in form : Automation API

Validating icon of titlebar in form

Class library usage, coding and language questions.

Validating icon of titlebar in form

Postby poojaagni » Wed Sep 24, 2008 12:29 pm

hi,

I am able to get form icon using form.Icon property... to compare this retrived icon cannot find any api.

FindImage and CompareImage methods returns false for title bar icon as point value is not set.

Could you please suggest me the solution for this?
poojaagni
 
Posts: 2
Joined: Wed Sep 24, 2008 12:18 pm

Postby Support Team » Wed Sep 24, 2008 1:17 pm

First of all you need to save the icon as a bitmap (see System.Drawing.Icon.ToBitmap method). Then you can use the CompareImage and FindImage methods of the form with the bitmap. You can calculate the offset for the CompareImage method by using the FindImage once.

The only thing with icons is that you need to consider transparent areas. When saving icons as a bitmap, these transparent colors will be replaced with a default color, so the transparency gets lost. So, if your form icon hast transparent areas, be sure to crop those areas with an image editor first.

Regards,
Alex
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests

cron