Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
How to change display settings: screen resolution, screen refresh rate
GDI+: Implementing image scrolling with inertia
Obtaining names and positions for shortcuts located on the Windows Desktop
Vertical Label control
Displaying dimmed window behind VFP top-level form
Enumerating devices installed on the local machine
How to generate GUID values
Printing Image File, programmatically set print page orientation to landscape
Monitoring clipboard content changes (VFP9)
Storing content of the Clipboard to a bitmap file
Subclassing CommandButton control to create BackColor property
Disconnecting USB Mass Storage Device programmatically
Splash Screen for the VFP application
Browsing Windows Known Folders (Special Folders)
Adding a background image to VFP report (VFP9, ReportListener)
Compressing and decompressing files with Windows API Runtime Library routines
How to load a user profile
How to put a vertical text scrolling on the form (a movie cast)
How to control Adobe Reader 9.0 (SDI mode) from VFP application
How to disable the Windows Clipboard (VFP9)
Generating random cryptographic keys
Detecting changes in connections to removable drives (VFP9)
How to put a horizontal text scrolling on the form (a news line, marquee)
GDI+: Implementing image scrolling with inertia

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
The inertial scrolling can be described as below:

   After releasing the mouse button, the image scrolling coninues while decelerating slowly, simulating the presence of inertia. The level of the deceleration depends on the momentum the mouse cursor obtains at the button release.

The code is based on custom GDI+ class. Download the class module first and save it in gdiplus.prg file.

Download image file (10,000 x 64 pixels) to be used with this code sample.

Otherwise use any wide image, preferrably 24-bit bitmap. I have no explanation yet, but the code sample works a bit different with PNG, JPEG, and 16-bit bitmaps. Even when they are directly converted from an original 24-bit bitmap file.

Visualization is implemented for the boundaries and the relative position.

See also:
  • GDI+: Scrolling through large image using the mouse
  • Creating thumbnails to preview images in a directory
      Members area. Log in to view this example.
      User name:
      Forgot your password?
      Sign up for
    the Membership

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    11171 bytes  
    Created: 2013-11-24 16:30:03  
    Modified: 2013-12-12 13:28:55  
    Visits in 7 days: 184  
    Listed functions:
    Printer friendly API declarations
    My comment:
    GDI+ provides adequate rendering as long as the image height stays below 100 pixels. For larger sizes as well as for some backgrounds the image tearing becomes more noticeable.

  • NetworkWorld: The iPhone patent Steve Jobs particularly cared about - inertial scrolling
  • Wikipedia: Scrolling
  • The Dynamics of Scrolling

    Scrolling deceleration algorithm used in this code sample produces comparatively good rendering, but still can be improved.

    stackoverflow: Duration for Kinetic Scrolling (Momentum) Based On Velocity?
    Provides a simple recipe for the rendering:
  • choose ticking frequency close to 16.7 msec (targeting 60 fps)
  • on each tick decrease the speed by 5%
  • stop scrolling either after a certain number of ticks or when the speed gets below a specified limit

    Also called Kinetic Scrolling.

    * * *

    I am working on a prototype of mouse-oriented ListView control. It will implement inertial scrolling, simple page flipping, ownerdraw items and more.

    Most likely the final control will be an ActiveX control. VCX or PRG version is also feasible. I did some prototyping in VFP using GDI+ class library with good results.

    The content of the control -- uniform-size items -- is positioned in rows and columns, and can be scrolled either vertically or horizontally.

    Two modes of scrolling are available. When the free scrolling is selected, the control moves its content matching the moves of the cursor. While selecting the page flipping makes the control display a specified number of rows and columns with fluid transition from page to page.

    One-row horizontal free scrolling example:

  • Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.

    Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    9 sec.Function: 'GdipDeleteFontFamily'
    Function group: 'GDI+ Font'
    17 sec.Function: 'CeFindNextDatabaseEx'
    Function group: 'Remote Application Programming (RAPI)'
    25 sec.Function: 'waveOutClose'
    Function group: 'Windows Multimedia'
    33 sec.Function: 'GdipGetMatrixElements'
    Function group: 'GDI+ Matrix'
    41 sec.Function: 'GdipGetPageScale'
    Function group: 'GDI+ Graphics'
    48 sec.
    Function group: 'GDI+ StringFormat'
    57 sec.Function: 'SQLConfigDataSource'
    Function group: 'ODBC API'
    1.1 min.Function: 'AVIStreamGetFrameOpen'
    Function group: 'Windows Multimedia'
    1.22 min.Function: 'NetWkstaTransportEnum'
    Function group: 'Network Management'
    1.5 min.Banners
    Advertise here!