View.Rectangle

Introduced

v9.0 (2011)

Description

Returns the rectangle of a view in screen coordinates as an Array of Longs. The returned array always contains exactly 4 items: left, top, right and bottom values (in that order).

C# Syntax

// get accessor
Object rtn = View.Rectangle;

Examples

1. VBScript Example

'
' This example demonstrates how to use the View.Rectangle property
'
set oView = Desktop.ActiveLayout.CreateView( "Explorer", "MyExplorer" )
oView.Move 100, 200
oView.Resize 500, 600
rect = oView.Rectangle
LogMessage( "Left = " & rect(0) )
LogMessage( "Top = " & rect(1) )
LogMessage( "Width = " & rect(2) - rect(0) )
LogMessage( "Height = " & rect(3) - rect(1) )
' Expected result:
' INFO : Left = 100
' INFO : Top = 200
' INFO : Width = 500
' INFO : Height = 600

2. JScript Example

//
// This example demonstrates how to use the View.Rectangle property
//
var oView = Desktop.ActiveLayout.CreateView( "Explorer", "MyExplorer" );
oView.Move( 100, 200 );
oView.Resize( 500, 600 );
var vba = new VBArray( oView.Rectangle );
var rect = vba.toArray();
LogMessage( "Left = " + rect[0] );
LogMessage( "Top = " + rect[1] );
LogMessage( "Width = " + (rect[2] - rect[0]) );
LogMessage( "Height = " + (rect[3] - rect[1]) );
// Expected result:
// INFO : Left = 100
// INFO : Top = 200
// INFO : Width = 500
// INFO : Height = 600

3. Python Example

#
# This example demonstrates how to use the View.Rectangle property
#
oView = Application.Desktop.ActiveLayout.CreateView( "Explorer", "MyExplorer" )
oView.Move( 100, 200 )
oView.Resize( 500, 600 )
(left, top, right, bottom) = oView.Rectangle
Application.LogMessage( "Left = " + str(left) )
Application.LogMessage( "Top = " + str(top) )
Application.LogMessage( "Width = " + str(right - left) )
Application.LogMessage( "Height = " + str(bottom - top) )
# Expected result:
# INFO : Left = 100
# INFO : Top = 200
# INFO : Width = 500
# INFO : Height = 600

See Also

View.Move View.Resize