UserForm.ClientWidth Property

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The ClientWidth property returns the width of the form’s client area. The client area is the part of the form without borders and title bars. You can use the ClientWidth property value in order to properly resize or position components on the form when the form size is changed.

To get or set the entire form width, use the Width property.

Declaration

UserForm.ClientWidth

Read-Only Property Integer

Applies To

The property is applied to the following object:

Property Value

An integer value that specifies the form’ client width, in pixels.

Example

The following example uses the ClientWidth and ClientHeight properties to resize the user form. The example assumes that the project contains a user form named TestForm which contains a button which the user clicks to change the form’s size.

JavaScript, JScript

// Displays the user form
function Test()
{
  var TestForm;
  // Obtains the user form
  TestForm = UserForms.TestForm;

  TestForm.ShowModal();
  …

}

// Resizes the user form upon clicking the button on it
function TestForm_btn_Resize_OnClick(Sender)
{
  var TestForm;
  TestForm = UserForms.TestForm;
  // Increases the user form size
  TestForm.Width = TestForm.ClientWidth + 20;
  TestForm.Height = TestForm.ClientHeight + 52;

}

Python

# Displays the user form 
def Test():
  # Obtains the user form
  TestForm = UserForms.TestForm
  TestForm.ShowModal()
  # ...
# Resizes the user form upon clicking the button on it
def TestForm_btn_Resize_OnClick(Sender):
  TestForm = UserForms.TestForm
  # Increases the user form size
  TestForm.Width = TestForm.ClientWidth + 20
  TestForm.Height = TestForm.ClientHeight + 52

VBScript

' Displays the user form
Sub Test

  Dim TestForm
  ' Obtains the user form
  Set TestForm = UserForms.TestForm

  TestForm.ShowModal
  …

End Sub

' Resizes the user form upon clicking the button on it
Sub TestForm_btn_Resize_OnClick(Sender)

  Dim TestForm
  Set TestForm = UserForms.TestForm
  ' Increases the user form size
  TestForm.Width = TestForm.ClientWidth + 20
  TestForm.Height = TestForm.ClientHeight + 52

End Sub

DelphiScript

// Displays the user form
procedure Test();
  var TestForm;
begin
  // Obtains the user form
  TestForm := UserForms.TestForm;

  TestForm.ShowModal;
  …

end;

// Resizes the user form upon clicking the button on it
procedure TestForm_btn_Resize_OnClick(Sender);
var TestForm;
begin
  TestForm := UserForms.TestForm;
  // Increases the user form size
  TestForm.Width := TestForm.ClientWidth + 20;
  TestForm.Height := TestForm.ClientHeight + 52;

end;

C++Script, C#Script

// Displays the user form
function Test()
{
  var TestForm;
  // Obtains the user form
  TestForm = UserForms["TestForm"];

  TestForm["ShowModal"]();
  …

}

// Resizes the user form upon clicking the button on it
function TestForm_btn_Resize_OnClick(Sender)
{
  var TestForm;
  TestForm = UserForms["TestForm"];
  // Increases the user form size
  TestForm["Width"] = TestForm["ClientWidth"] + 20;
  TestForm["Height"] = TestForm["ClientHeight"] + 52;

}

See Also

ClientHeight Property
Height Property
Width Property

Highlight search results