我的代码:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim top As Integer = 0
For i = 0 To 10
Dim inLine As Integer = 8
Dim left As Integer = 0
For x = 0 To inLine
Dim s As New Panel
s.BackColor = Color.Black
s.Width = 10
s.Height = 10
s.Left = left
s.Top = top
left = left + 20
AddHandler s.MouseHover, AddressOf Panel1_MouseHover
Me.Controls.Add(s)
Next
top = top + 20
Next
End Sub
Private Sub Panel1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs)
/////---- Some code!! :/
End Sub
我的代码将面板添加到我的 from 中,
我希望当鼠标悬停在面板上时面板更改背景颜色。
如果有人不明白:
当我的鼠标悬停在我添加到表单中的面板时,我如何更改面板的背景颜色?
Private Sub Panel1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs)
/////---- Some code to change the panel color !! :/
End Sub