nobugz. #Include, , . include 8 .
: , , - , :
Class CommonChanges
Private Readonly WithEvents DerivedUserControl As Windows.Forms.Control
Public Sub New(ByVal derivedUserControl As Windows.Forms.Control)
Me.DerivedUserControl = derivedUserControl
End Sub
Private Sub DerivedUserControl_OnClick(sender As Object, e As EventArgs) _
Handles DerivedUserControl.Click
' ... '
End Sub
... ' (more event handlers with common code go here) '
End Class
8 , :
Class MyDerivedUserControl
Extends Button ' (or whatever control it extends) '
Private ReadOnly Changes As CommonChanges
Public Sub New
Changes = New CommonChanges(Me)
' ^ 'CommonChanges' will subscribe to this class events and possibly
' apply other changes to the control object 'Me'.
...
End Sub
End Class
Changes CommonChanges MyDerivedUserControl , CommonChanges .
, Control, CommonChanges .