Results 1 to 2 of 2

Thread: Highlight labels on a form (they act as command buttons)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    North East America
    Posts
    463

    Post

    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
    [email protected]



  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    North East America
    Posts
    463

    Post

    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
    [email protected]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width