Skip to content

[Guide]Make a Panel control that raises a Scroll event in Visual Basic .NET

Featured Replies

Description This example shows how to make a Panel control that raises a Scroll event in Visual Basic .NET.

Keywords scroll, Panel, AutoScroll, scroll event, VB.NET

Categories Controls, VB.NET

The ScrollPanel control inherits from the Panel control. It overrides its WndProc subroutine to look for the WM_HSCROLL and WM_VSCROLL messages and raises its Scroll event when it detects one.

 

 

<ToolboxBitmap(GetType(ScrollPanel), _

    "ScrollPanelTool.bmp")> _

Public Class ScrollPanel

    Inherits Panel

 

    Public Event Scroll(ByVal sender As Object)

    Public Const WM_HSCROLL As Integer = &H114

    Public Const WM_VSCROLL As Integer = &H115

 

    Protected Overrides Sub WndProc(ByRef m As Message)

        If m.Msg = WM_HSCROLL Then

            RaiseEvent Scroll(Me)

        ElseIf m.Msg = WM_VSCROLL Then

            RaiseEvent Scroll(Me)

        End If

 

        MyBase.WndProc(m)

    End Sub

End Class

 

http://rapidshare.com/files/265348592/panel_scroll_event.rar

* i dont know if something like that already posted

Credits to : Qoswarth (an old friend)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.