ClientHeight, ClientLeft, ClientTop, ClientWidth Properties Example

Microsoft Office Outlook 2003

The following example sets the dimensions of an Image to the size of a TabStrip's client area when the user clicks a CommandButton. This code sample uses the following properties: Height, Left, Top, Width, ClientHeight, ClientLeft, ClientTop, and ClientWidth.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

  • A CommandButton named CommandButton1.
  • A TabStrip named TabStrip1.
  • An Image named Image1.
Dim CommandButton1
Dim Image1
Dim TabStrip1

Sub Item_Open
  Set CommandButton1 = Item.GetInspector.ModifiedFormPages("P.2").CommandButton1
  Set Image1 = Item.GetInspector.ModifiedFormPages("P.2").Image1
  Set TabStrip1 = Item.GetInspector.ModifiedFormPages("P.2").TabStrip1

  CommandButton1.Caption = "Size Image to Tab Area"
  CommandButton1.WordWrap = True
  CommandButton1.AutoSize = True
End Sub

Sub CommandButton1_Click
  Image1.ZOrder (fmFront) 'Place Image in front of TabStrip

'Client Left and ClientTop are measured from the edge of the TabStrip,
'not from the edges of the form containing the TabStrip.
  Image1.Left = TabStrip1.Left + TabStrip1.ClientTop
  Image1.Top = TabStrip1.Top + TabStrip1.ClientTop
  Image1.Width = TabStrip1.ClientWidth
  Image1.Height = TabStrip1.ClientHeight
End Sub