Height Property

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

The Size.Height property lets you get and set the image height.

Declaration

SizeObj.Height

Read-Write Property Integer
SizeObj An expression, variable or parameter that specifies a reference to a Size object

Applies To

The property is applied to the following object:

Property Value

The height (in pixels) of the rectangular area specified by the given Size object.

Example

The code below demonstrates how you can load an image from a file and then retrieve the width and height of the image.

JavaScript, JScript

function Test1()
{
  // Creates a new empty Picture object
  Pict = Utils.Picture;

  // Loads the image from a file and posts it to the log
  Pict.LoadFromFile("D:\\Data\\my_image.png");
  Log.Picture (Pict, "My image");

  // Posts the image’s size to the log
  Log.Message (Pict.Size.Width);
  Log.Message (Pict.Size.Height);
}

Python

def Test1():
  # Creates a new empty Picture object
  Pict = Utils.Picture

  # Loads the image from a file and posts it to the log
  Pict.LoadFromFile("D:\\Data\\my_image.png")
  Log.Picture(Pict, "My image")

  # Posts the image's size to the log
  Log.Message(str(Pict.Size.Width))
  Log.Message(str(Pict.Size.Height))

VBScript

Sub Test1
  ' Creates a new empty Picture object
  Set Pict = Utils.Picture

  ' Loads the image from a file and posts it to the log
  Call Pict.LoadFromFile("D:\Data\my_image.png")
  Log.Picture Pict, "My image"

  ' Posts the image’s size to the log
  Log.Message Pict.Size.Width
  Log.Message Pict.Size.Height
End Sub

DelphiScript

procedure Test1;
begin
  // Creates a new empty Picture object
  Pict := Utils.Picture;

  // Loads the image from a file and posts it to the log
  Pict.LoadFromFile('D:\Data\my_image.png');
  Log.Picture (Pict, 'My image');

  // Posts the image’s size to the log
  Log.Message (Pict.Size.Width);
  Log.Message (Pict.Size.Height);
end;

C++Script, C#Script

function Test1()
{
  // Creates a new empty Picture object
  Pict = Utils["Picture"];

  // Loads the image from a file and posts it to the log
  Pict["LoadFromFile"]("D:\\Data\\my_image.png");
  Log["Picture"](Pict, "My image");

  // Posts the image’s size to the log
  Log["Message"](Pict.Size.Width);
  Log["Message"](Pict.Size.Height);
}

See Also

Size.Width

Highlight search results