2010年7月13日 星期二

form Controls 控制

Option Explicit

Dim LastIndex As Integer

Private Sub Form_Load()
LastIndex = -1
End Sub

Private Sub Frame1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

On Error GoTo Frame1_MouseMoveError

Dim C As Control

If LastIndex = Index Then Exit Sub

For Each C In Me.Controls

If TypeOf C Is Label Then

If C.Container.Name = "Frame1" Then

If C.Container.Index = Index Then

C.BackColor = vbGreen

Else

C.BackColor = vbButtonFace

End If

End If

End If

Next

LastIndex = Index

Exit Sub
Frame1_MouseMoveError:

MsgBox "Frame1_MouseMove: " & Err.Number & ":" & Err.Description

End Sub

沒有留言:

張貼留言