Home > Code Library > SmartViewport > PageWidth

Last Update 24 May 2001

 


Search:



  

Options:

   

   

   

   



SmartViewport
Reference

PageWidth

Returns the width of the viewport virtual page. This property is not available at design time and is read-only at run-time.

Syntax

object.PageWidth

The object placeholder represents an object expression that evaluates to a SmartViewport object.

Remarks

This property is only available at run-time. The viewport internally mantains a virtual page which size and position are based on the layout of its visible contained controls. The PageWidth value corresponds to the distance between the left-most and right-most contained controls. If you add controls dynamically at run-time you should use the method Refresh to force the viewport to re-calculate its vitual page bounds.

Example:

'Add a CommandButton to SmartViewport1
'with properties [Left=135;Top=135;Height=495;Width=1455;Index=0]


'Current PageWidth returns 1590 (=135+1455)
Debug.Print "PageWidth = "; SmartViewport1.PageWidth

'Load a new instance of Command1
Load Command1(1)
Command1(1).Left = 2400
Command1(1).Visible =
True

'Refresh the viewport
SmartViewport1.Refresh

'Current PageWidth is now 3855 (=2400+1455)
Debug
.Print "PageWidth = "; SmartViewport1.PageWidth

 
Copyright © 2001, Andrés Pons (andres@vbsmart.com). All rights reserved.