Description
The ClientHeight
property returns the height of the form’s client area. The client area is the part of the form without borders and title bars. You can use the ClientHeight
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 height, use the Height
property.
Declaration
Applies To
The property is applied to the following object:
Property Value
An integer value that specifies the form’ client height, 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
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
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
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
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
UserForm.ClientWidth Property
UserForm.Height Property
UserForm.Width Property