method to check element is not covered by others

Class library usage, coding and language questions.
hobli
Posts: 57
Joined: Thu Jul 30, 2009 1:15 am

method to check element is not covered by others

Post by hobli » Thu Apr 29, 2010 4:20 am

Hi,

sorry if my question is a little stupid, but this is what I need:
I want to capture screen-shot for an element without force it to "foreground" by using 'ensurevisible()'.
So I need to check if the element is really visible --- not covered by (or overlapping with) any other elements.
Before I write a function to scan through all elements on the screen and examine their location and size, I would like to see if there are any simple to use.

The "visible" property of an element does not guarantee it is not covered by/overlapped with other elements.

thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: method to check element is not covered by others

Post by Support Team » Thu Apr 29, 2010 12:39 pm

Hi!

Ranorex has a method called CaptureImageHidden(). This method provides you the functionality to catch a screenshot of an element, when it's for example in the background of another application (but not minimized). Please take attention to work with this method, because not all technologies support this feature.
Bitmap bmp = Imaging.CaptureImageHidden("yourPath");
bmp.Save("myBmp.bmp");
Regards,
Peter
Ranorex Support Team
.
Image

hobli
Posts: 57
Joined: Thu Jul 30, 2009 1:15 am

Re: method to check element is not covered by others

Post by hobli » Thu May 06, 2010 2:17 am

Thanks for your reply. But my intention is to capture the screen the same as human seeing on the screen.
In a case where the element is 'covered' by other elements, then the image captured should truly reflect this fact. Calling function "CaptureImageHidden()" is not doing this.

I have an solution now:
dim bmpImg as BitMap

bmpImg = imaging.CaptureDesktopImage(anelement.ScreenRectangle)
bmpImg.Save("imgfile.bmp", system.Drawing.Imaging.ImageFormat.Bmp)