Download source files - 3 Kb
Download demo project - 31 Kb
Introduction
This class is useful for scrolling CWnd
derived objects, for example CScrollView
,
and helps you to handle mouse cursor movement near the client's
border. The CTimerScroll
object sends WM_HSCROLL
and WM_VSCROLL
messages to your
object.
It has only 3 methods:
Register(CWnd* pWnd)
- Registers the windows object to send messages to.
Install()
- Installs the timer and captures the mouse cursor
Unistall()
- Helper method to unistall the timer.
How to use
- Insert a
CTimerScroll
object in your CWnd derived class.
- Invoke
Register
in your init creation process. For example
OnInitialUpdate
, OnCreate
, ....
- In the
OnLButtonDown
message handler, call Install()
, this
method capture the mouse for you.
- In the
OnLButtonUp
message handler, call ReleaseCapture
, to
release the mouse. This unistall the timer automatically.
Of course you must handle the scrolling messages.
Sample code
The TSSample sample is a MFC SDI VC++6 aplication sample, and uses the CTimerScroll
.
The TSSampleView is derived from CScrollView
(this MFC class have scroll handler
methods build in).