Импортирует System.ComponentModel
Publi c Класс frmScreen Наследует форму Dim CellColor As PictureBox '' '
Private Sub Screen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CellColor = New PictureBox
With CellColor
.BackColor = Color.Azure
'
'
'
End With
'When you do click on the CellColor control the you go to ScreenPicBox method
AddHandler CellColor.Click, AddressOf ScreenPicBox_Checked
'If you need to remove by code the handler you can write the following instruction
RemoveHandler CellColor.Click, AddressOf ScreenPicBox_Checked
End Sub
Private Sub ScreenPicBox_Checked(sender As Object, e As EventArgs)
If TypeOf sender Is PictureBox Then
'do anything here
End If
End Sub
Конечный класс
Я надеюсь, что это показывает как хочешь, Дарп мо sh. Удачного кодирования! :)