Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake a Panel control that raises a Scroll event in Visual Basic .NET
DescriptionThis example shows how to make a Panel control that raises a Scroll event in Visual Basic .NET.
Keywordsscroll, Panel, AutoScroll, scroll event, VB.NET
CategoriesControls, 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated