MouseOver Highlighting of Label - Userform Flickering Problem

RawlinsCross

Active Member
Joined
Sep 9, 2016
Messages
437
Hey there, so I have a series of labels which I've identified as "Well" in the tag property. The idea is to highlight upon mouse hover to vbGreen just to add a level of user-interaction. I have it completely working (code below) based on a class module approach but if I hold the mouse over any of the label, there is intermittent flickering of all the other labels. Even if I just hold the mouse icon over the label and not move, the flickering is really noticeable and distracting. The highlighting feature is great but not at the expensive of all this flickering. What can I do here?

Class Module
VBA Code:
Option Explicit

Public WithEvents WellAnalysisGroup As MSForms.Label

Private mfrmParent As Object

'--public properties
Public Property Set Parent(frmParent As Object)
    Set mfrmParent = frmParent
End Property

'--event procedures
Private Sub WellAnalysisGroup_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)

'This clears resets all the color
Call WellAnalysisGroup.Parent.ResetColor
'After everything is cleared, this changes the color
WellAnalysisGroup.BackColor = vbGreen

End Sub

I'll forgo the code that sets up the class module, nothing wrong with that. Below is the code called by the class module

Userform Code
VBA Code:
Public Sub ResetColor()

Dim ctrl As Control

For Each ctrl In Me.Controls
    If TypeName(ctrl) = "Label" Then
       If ctrl.Tag = "Well" Then
       ctrl.BackColor = vbWhite
       End If
   End If
Next ctrl

End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Maybe you should not set the property unless you must. Try
If ctrl.BackColor <> vbWhite Then ctrl.BackColor = vbWhite
 
Upvote 0
From the province of Newfoundland and Labrador in eastern Canada. Labrador is known as the big land here - but I guess there's a few places around the world that could qualify including Wyoming (never been).
 
Upvote 0
There is a city in Wyoming name Rawlins and you mentioned big land. That's why I asked. Compared to where I live, Wyoming is ginormous. Greetings neighbor! I'm currently from Indiana. Have a great Sunday!
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,824
Members
449,050
Latest member
Bradel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top