如何使鼠标移动到图片时,图片高亮?即WIN7下鼠标移动到桌面快捷方式图标时显示的效果
如图
如何使鼠标移动到图片时,图片高亮?即WIN7下鼠标移动到桌面快捷方式图标时显示的效果?
[解决办法]
所谓的高亮,并不是图片高亮(如果图片高亮,那么图片可能会失真),应该是背景高亮
按这个想法,其实应该很简单,使用一个图片图片框做背景,用一个Image做为装图片的放在图片框中间,然后在Image上设置上图片,拷贝下面代码到你的Form里
Dim BC As Long
Dim BC1 As Long
Private Sub Form_Load()
Dim R As Long, G As Long, B As Long
BC = &HC0C0C0
BC1 = &HE0E0E0
Picture1.BackColor = BC
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
With Picture1
If X > 100 And X < .Width - 100 And Y > 0 And Y < Height - 100 Then
.BackColor = BC1
Else
.BackColor = BC
End If
End With
End Sub