Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Storing content of the Clipboard to a bitmap file
Displaying icons in the system tray (VFP9)
Storing screen shot of a form to bitmap file
How to print FoxPro form
How to print a bitmap file
Capturing keyboard activity of another application with the Raw Input API (VFP9)
GDI+: Implementing image scrolling with inertia
Obtaining names and positions for shortcuts located on the Windows Desktop
Monitoring clipboard content changes (VFP9)
Browsing Windows Known Folders (Special Folders)
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
GDI+: reading and writing metadata in JPEG and TIFF files
Using NetWkstaTransportEnum to obtain MAC Address of remote server
Enumerating Processes -- WinNT
Displaying dimmed window behind VFP top-level form
Pocket PC: custom RAPI class for operating with files and folders on mobile device
HOWTO: Use the Win32 API to Access File Dates and Times
Using InternetSetFilePointer when resuming interrupted download from the Internet
How to view icons stored in executable files (Icon Viewer) - II
Printing Image File, programmatically set print page orientation to landscape
Attaching menu to a top-level form
Enumerating devices installed on the local machine
How to change display settings: screen resolution, screen refresh rate
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:
      Password:
     
     
      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: 181  
    Listed functions:
    GetAsyncKeyState
    GetCapture
    GetCursorPos
    GetDC
    GetMouseMovePointsEx
    GetTickCount
    GetWindowDC
    IsWindow
    ReleaseCapture
    ReleaseDC
    SetCapture
    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.

    * * *
    2013-December

    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  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright 2001-2017 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.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.156.92.243)
    11 sec.Example: 'How to hot-track menu item selection in top-level form (requires VFP9)'
    23 sec.Function: 'CreateMD5SSOHash'
    Function group: 'Internet Functions (WinInet)'
    32 sec.Function: 'GdipGetImagePaletteSize'
    Function group: 'GDI+ Image'
    42 sec.
    54 sec.Function: 'CryptUnprotectData'
    Function group: 'Cryptography Reference'
    1.08 min.Function: 'mciSendCommand'
    Function group: 'Windows Multimedia'
    1.25 min.Example: 'How to find which fonts Windows uses for drawing captions, menus and message boxes'
    1.45 min.Solutions
    1.62 min.Function: 'GetFileSizeEx'
    Function group: 'File System'
    1.8 min.Function: 'IsWow64Process'
    Function group: 'Process and Thread'
    Google
    Advertise here!