Jump to content

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


Recommended Posts

Posted

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

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..