MouseMove

F

Fysh

I have a form with several icons to perform certain
procedures. Around each of these icons I have a box.
When I MouseMove over these icons I would like for the
background and borderstyle to change. This part I have
working. Does anyone know how to undo the change if I
move the mouse away from the icon? Here is my code so far.
This is Access 2K

Thanks for any assistance.

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

Me.Box72.BorderStyle = 1
Me.Box72.BackColor = 8454143

End Sub
 
A

Allen Browne

To reset it, use the MouseMove event of the Detail section of your form, and
the MouseMove of any other control.
 
D

Dirk Goldgar

Fysh said:
I have a form with several icons to perform certain
procedures. Around each of these icons I have a box.
When I MouseMove over these icons I would like for the
background and borderstyle to change. This part I have
working. Does anyone know how to undo the change if I
move the mouse away from the icon? Here is my code so far.
This is Access 2K

Thanks for any assistance.

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

Me.Box72.BorderStyle = 1
Me.Box72.BackColor = 8454143

End Sub

Use the MouseMove event of the surrounding section, or of a box
surrounding each control, to reset the BorderStyle and BackColor of
whatever control is currently highlighted. You might consider having a
global variable to hold the name of the control that is currently
highlighted, and use that to simplify matters. For example,

'----- start of example module code -----
Dim mstrHighlightedControl As String

Private Function HighlightControl(pstrCtlName As String)

UnhighlightControl

With Me.Controls(pstrCtlName)
.BorderStyle = 1
.BackColor = 8454143
mstrHighlightedControl = pstrCtlName
End With

End Function

Private Function UnhighlightControl()

If Len(mstrHighlightedControl) > 0 Then
With Me.Controls(mstrHighlightedControl)
.BorderStyle = 0 ' unhighlighted value
.BackColor = ?????? ' unhighlighted value
End With
End If

mstrHighlightedControl = vbNullString

End Function
'----- end of example module code -----

Then you could call the HighlightControl function directly from the
OnMouseMove event property of the relevant image control ...

=HighlightControl("Box72")

and call the UnhighlightControl function from the OnMouseMove event
property of the surrounding section:

=UnhighlightControl()
 
F

Fysh

Thanks, the detail part works like a charm. I figured it
out right when I got your reply. I guess I should have
worked on it a little harder before I sent a request for
help.
 

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