|
|
|
|
|
About this page
You need a scrolling area?
A Pager perhaps?
In this page you will find a viewport control that you can
freely use in your applications.
Downloads
Requires SmartSubclass
|
|
How many times have you needed to use scrollbars in
your VB projects? Probably not too many but, when you need them, there's no other
solution than having to hard-code all necessary procedures and functions to
handle the required scrolling behaviour. That is, resizing the scrollbar, setting
correct values for its 'Min' and 'Max' properties, deciding what values should
'LargeChange' and 'SmallChange' have and, finally, adding code to the 'Change'
event in order to reposition whatever objects you want to scroll - not so difficult
but time-consuming.
It makes sense to have a control that does all this for us. Viewports do not
come as components with VB6, although there's a very good component called 'Panel'
which comes with .NET and has scrolling capabilities. Anyway, the fact is that
we do not have a scrolling Viewport in VB6 unless we buy one from a third-party
company or we build one ourselves.
SmartViewport is a free control-container that allows you to build scrolling
viewports in a matter of seconds. It has a large set of properties that will give
you total control of the viewport behaviour. You just have to place a SmartViewport
in your form, drop on it as many controls as you want and run your application.
SmartViewport will automatically pop-up scrollbars as soon as any contained
control gets out of its client area.
To better understand how SmartViewport works lets take a look at the following
diagram:
The blue rectangle represents the viewport visible area. You can get its size
by accessing properties 'Width' and 'Height'. The outer rectangle is the virtual
page which is scrolled within the viewport. The size of this virtual page is
automatically calculated based on the layout of the contained controls. You
can read its dimensions through properties PageLeft,
PageTop, PageWidth
and PageHeight. If you add
new controls to the viewport at run-time you should use method Refresh
to let the viewport re-calculate the virtual-page bounds. OffsetX
and OffsetY are the amount of
twips the viewport has scrolled to either right or bottom of the page. You can
read these properties at run-time but you can't modify them. Instead, you should
use method Scroll to manually scroll
the viewport. Finally, properties OffsetRight
and OffsetBottom represent
the distance between the last visible object and the viewport border. These
properties are equal to 0 by default. You may want to have an offset to avoid
your objects sticking to the right and bottom borders.
You can find below a list of properties, methods and events for the SmartViewport:
27.May.2001
28.May.2001
An error was generated when SmartViewport was
acting as a component of a usercontrol.
This bug is now fixed.
An error was generated when the size of the
virtual page was greater than 32,767 twips.
This bug is now fixed and now the size of the virtual page can go up
to 491,505 twips.
Thanks to Károly Ladvánszky for finding these two problems.
28.September.2001
|
|