Mouseovers

M

Mike

Hello.

Is it possible to do mouseover buttons on a form and if
so, how?

Thanks in advance,

m.
 
D

Dirk Goldgar

Mike said:
Hello.

Is it possible to do mouseover buttons on a form and if
so, how?

Thanks in advance,

Yes. You can use a label control instead of a command button. In the
label's MouseMove event, set its SpecialEffect property to Raised, and
in the MouseMove event of the surrounding form section, set it back to
Flat. Like this:

'----- start of example code -----
Private Sub lblMouseOver_MouseMove( _
Button As Integer, _
Shift As Integer, X As Single, _
Y As Single)

With Me.lblMouseOver
If .SpecialEffect = 0 Then .SpecialEffect = 1
End With

End Sub

Private Sub Detail_MouseMove( _

Button As Integer, _
Shift As Integer, X As Single, _
Y As Single)

With Me.lblMouseOver
If .SpecialEffect = 1 Then .SpecialEffect = 0
End With

End Sub
'----- end of code -----

You have to be careful about putting the "buttons" too close to each
other or to the edge of the form, or else the Detail section's MouseMove
event may not get a chance to fire on rapid mouse movements.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top