【发布时间】:2014-01-07 17:08:48
【问题描述】:
我看到的每个示例都是关于鼠标单击的,然后示例是相同的。
我需要专门在另一个控件上引发事件。
我有一个面板,其中包含我这样创建的事件:
Private FlowPanel as new my_FlowLayoutPanel
Addhandler FlowPanel.change, addressof doChange
Public Class my_FlowLayoutPanel
Inherits FlowLayoutPanel
Public Event change(ByVal sender As Object)
Public Const Ver_SCROLL As Integer = &H115
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = Ver_SCROLL Then
RaiseEvent change(Me)
End If
MyBase.WndProc(m)
End Sub
End Class
所以当垂直滚动条移动时,“change”事件就会触发。
所以现在,我有另一个控件,(一个简单的面板)设置如下:
Public Class view_Panel
Inherits System.Windows.Forms.Panel
Protected Overrides Sub WndProc(ByRef m As Message)
Const NCMOUSEMOVE As Integer = &H200
If m.Msg = NCMOUSEMOVE Then
' *** FIRE THE "CHANGE" EVENT ON THE FLOWLAYOUT PANEL
End If
MyBase.WndProc(m)
End Sub
End Class
那么,如何从 view_Panel 触发“Change”事件?
【问题讨论】:
-
这些控件在表单上如何相互关联?
-
my_FlowLayoutPanel 驻留在哪里?