|
|
Title | Make a Panel control that raises a Scroll event in Visual Basic .NET |
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
|
|
|
|
|
|