PDA

Click to See Complete Forum and Search --> : Highlight labels on a form (they act as command buttons)


Troy Mac
Nov 10th, 1999, 04:54 PM
Can anyone figure out why this does not work? I have four labels on the form and label1 works sometimes but the other ones will not change color until i click them I think there maybe something wrong with the SetCapture function it seems to bog things down. And most of the time nothing happens when I click Label1. It is supposed to show form2. Any Ideas

Thanks All

'module
Public Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long


'Code
Private Sub LblNewGame_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

'Put this in the mouse_move event of your control:

With LblNewGame
If Button = 0 Then
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
ReleaseCapture
'Do your 'mouse-exit' stuff here
.ForeColor = &HFFFF00 '&H808000
' Else
SetCapture (hwnd)
' Do your 'mouse-enter' stuff here
.ForeColor = &HFFFF00
End If
End If
End With
End Sub

------------------
Troy MacPherson
Customer Suport Software Analyst
t_macpherson@yahoo.com

Troy Mac
Nov 10th, 1999, 05:16 PM
Never mind I did a dumb thing. In the form mouse move event if you have more than one label well you need to put the other labels in there like this

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
LblNewGame.ForeColor = &H808000
LblExit.ForeColor = &H808000
LblLoadGame.ForeColor = &H808000
LblStats.ForeColor = &H808000
End Sub

i just had the first one in there thats why only the first one worked Da!!!



------------------
Troy MacPherson
Customer Suport Software Analyst
t_macpherson@yahoo.com