ImageRectangle Method (TestObject)

Class

TestObject.

Action

Returns the object-relative rectangle of the specified image asset.

Syntax

C#
returnRectangle = TestObject.ImageRectangleFile(imageAsset, [occurence, searchRectangle])
VB
returnRectangle = TestObject.ImageRectangleFile(imageAsset, [occurrence, searchRectangle])
Variable Description
returnRectangle The rectangle of the specified image asset or an empty rectangle if the image asset is not found. Rect.
imageAsset A .imageasset file. This file must be an embedded resource in the test assembly. String.
occurrence Optional: The occurrence of the image asset for which the rectangle should be returned, if there are multiple occurrences. The first occurrence is 1. The default value is 1. Integer.
searchRectangle Optional: The object-relative rectangle in which to search for the image asset. Rect .

C# Example

Assume you have an image asset with the name myImage. To get the object-relative rectangle of the image, you can use the following code:
 
imageRectangle = control.ImageRectangle("myImage");

Visual Basic Example

Assume you have a PNG image with the name myImage. To get the object-relative rectangle of the image, you can use the following code:
 
imageRectangle = control.ImageRectangle("myImage")