• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

Highlight a series of control arrays

I have created a control array consisting of a series of labels.
When I move the mouse over each label, I want the label to grow in size.
In other words the label's font must grow in size when the cursor moves over.
I tried to pin point the cursor but it doesn't work for each individual label.
please help!!

I used the following code:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim z
CurrentX = X
CurrentY = Y
Text1.Text = X
Text2.Text = Y
CurrentX = X > 595 And X < 795
If z < 695 And Y < 480 Then
        Label1(index).FontSize = 30
    Else
        Label1(index).FontSize = 20
    End If
End Sub
0
esolve
Asked:
esolve
1 Solution
 
tureCommented:
esolve,

Try something like this:

Dim boldctl As Control

Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  Set boldctl = Label1(Index)
  boldctl.FontBold = True
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Not boldctl Is Nothing Then
    boldctl.FontBold = False
    Set boldctl = Nothing
  End If
End Sub

Ture Magnusson
Karlstad, Sweden
0
 
mcriderCommented:
Try this example... If you use it, reject the current answer:

Add 3 indexed labels to a new form.

Add the following to the form and run the program... Move the mouse over the labels...


Cheers!

The Code:


Private Sub Form_Load()
    Label1(0).Tag = "0"
End Sub
Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Fix(Label1(Index).FontSize) > 8 Then Exit Sub
    Label1(CInt(Label1(0).Tag)).FontSize = 8
    Label1(0).Tag = CStr(Index)
    Label1(Index).FontSize = 14
End Sub


0
 
esolveAuthor Commented:
Thanks Ture - this will do just fine!!!
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Tackle projects and never again get stuck behind a technical roadblock.
Join Now