When Windows Scroll event is triggered

  • Thread starter Thread starter Amir Ali
  • Start date Start date
A

Amir Ali

Dear All,
How can I come to know that Form's scroll' position is changed
(eigther by code or user interaction).

Amir Ali.
 
Hi,

Override the forms wndproc. You will recieve the wm_hscroll and
wm_vscroll messages.

Private Const WM_VSCROLL As Integer = &H115
Private Const WM_HSCROLL As Integer = &H114
Protected Overrides Sub WndProc(ByRef m As Message)
' Listen for operating system messages

If m.Msg = WM_VSCROLL Then
' Vertical scroll
ElseIf m.Msg = WM_HSCROLL Then
' Horizontal scroll
End If

MyBase.WndProc(m)
End Sub

Ken
---------------
Amir Ali said:
Dear All,
How can I come to know that Form's scroll' position is changed
(eigther by code or user interaction).

Amir Ali.
 
Thanks Ken, the code you provided works.

Now, will you guide me how I can handle form's scroll.

Means, sometimes ( not always) I want to stop scrolling.

Is it possible.

A lot of thanks.

Amir Ali.
 
Hi,

Just suppress the wm_hscroll or wm_vscroll message by not calling
mybase.wndproc(m) when you want to stop scrolling.

Ken
--------------
Amir Ali said:
Thanks Ken, the code you provided works.

Now, will you guide me how I can handle form's scroll.

Means, sometimes ( not always) I want to stop scrolling.

Is it possible.

A lot of thanks.

Amir Ali.
 
Dear Ken,
Thanks again for your continuous response. I am just one step
away from my solution. Please guide me to that destination.

Now, I just want to know message number (like &h15) of

(1) when scroll position is changed automatically (without user
interaction with scroll).
OR

(2) Message number of event when some controls location is changed.

With a lot of thanks. and waiting for response,
Amir Ali.
 
Back
Top