Results 1 to 2 of 2

Thread: Mouse over activex control

  1. #1
    Brian
    Guest

    Mouse over activex control

    I made a button ocx which uses graphics. Say for instance I have 2 sets of images that whenever the mouse is over the control, image 2 is visible and when the mouse if outside the control, image 1 would be visible. Easier said, just like a link button that whenever the mouse is over a link, it changes color then back. How do I do this? I tried using HitTest event but never worked. Pls help. Thanks!

  2. #2
    New Member
    Join Date
    Apr 2002
    Location
    Melbourne, Australia
    Posts
    2
    Hi,

    I think you're looking for the SetCapture and ReleaseCapture API calls.

    I wrote a control button that changes the backcolour based on mouse overs with the following code...

    ' Toggle the hover colour on or off
    Private Sub SetHoverColour(ByVal x As Single, ByVal y As Single)
    On Error Resume Next

    With lblCaption

    ' Check if over the control or not
    If (x < 0) Or (y < 0) Or (x > .Width) Or (y > .Height) Or Not mblnUseHover Then
    ReleaseCapture
    .BackColour = mlngBackColour
    Else
    SetCapture .hwnd
    .BackColour = mlngHoverColour
    End If

    End With

    End Sub


    Hope that helps. You should be able to convert that code into what you need.

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