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)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...