VerticalScroll Event

Applies to:  Subclasser object, PowerForm control
See also:  HorizontalScroll Event, MinVerticalScroll Property, MaxVerticalScroll Property, VerticalScrollPage Property

Occurs when the window subclassed by a Subclasser object or PowerForm control is scrolled vertically.

Syntax:

Private Sub object_HorizontalScroll(ByVal ScrollEvent As AkemiPowerPack.VerticalScrollEvent, ByVal Position As Long, Cancel As Boolean)

The VerticalScroll event syntax has these parts:

Part Description
object The name of an object in the Applies to list.  If object is a SubClasser object, then the object must be declared using WithEvents.
ScrollEvent One of the following values:
  • vsEndScroll
  • vsTop
  • vsBottom
  • vsUpOne
  • vsDownOne
  • vsPageUp
  • vsPageDown
  • vsThumbPosition
  • vsThumbTrack
Position The window's current vertical scroll position.
Cancel A flag indicating whether to cancel the scroll event.

Remarks:

It is up to the application to redraw the contents of the window in response to a scroll event.

It is not necessary to deal with the individual values of ScrollEvent, although doing so may improve performance.

Example:

The following snippet is a modified version of an event handler in the StandardScrollbars example.  This modified version of the event handler will only redraw the grid when scrolling is finished, rather than redrawing the grid several times during the scroll operation, as in the actual example application.

Private Sub PowerForm1_VerticalScroll(ByVal ScrollEvent As AkemiPowerPack.VerticalScrollEvent, ByVal Position As Long, Cancel As Boolean)
    lmVerticalScrollPos = Position

    'Draw the grid
    If ScrollEvent = vsEndScroll Then
        DrawGrid
    End If
End Sub

Further examples:

Standard Scroll Bars

 

Home

Copyright and Disclaimer