Mouse-move flicker, modeless form & shape selected


Paul Stevens

I have MouseMove code in my Modeless form which works
fine. However if a shape is selected its border and
handles flicker vigorously while the mouse is over any
control with mousemove code.

I created a test form, no controls, minimal code to show
the form vbmodeless and the opening and closing lines of
the form's mouse move event.

Run the form, select a shape, move or merely hover the
mouse over the form and the selected shape border flickers.

If the form window is active the flicker is considerably
less, but still noticeable. I do not want to disable
screenupdating or switch Excel / form windows.

Any ideas how to eliminate or reduce this flickering
border much appreciated. XL2K, not updated.


Rob van Gelder

Running the same on Windows XP.
I created a modeless userform with a hollow mousemove event.
Shape border doesn't flicker no matter what I do.

What shape are you using? Is the shape on the worksheet or in the form?

It could be a graphics driver issue, but it's strange that the border is
redrawing in the first place. Maybe I just don't notice it on my computer.

Flickering is caused when the screen is updated before the graphics are
fully redrawn.
The first frame updates the screen with the border being cleared, the second
frame updates the screen with the border drawn. Which appears as a flicker.

In the graphics world, they have a concept of double buffering. The screen
is only updated once the graphics is ready to be displayed.

Not that this has much to do with Excel, just thought it would be
interesting to know...
Other than that, I'm not a lot of use on this problem.

Paul Stevens

Thanks for looking at this and responding,

The "flicker" occurs when a drawing shape on the worksheet
or inserted into a chart is selected. And, I move or
hover the mouse over any control in a modeless form that
traps the mousemove event.

The problem does not occur if a chart or an OLEobject is

I've stripped all code to absolute minimum:

Sub Loadform()
UserForm1.Show vbModeless
End Sub

Private Sub UserForm_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y
As Single)
' this in the form module
End Sub

As I mentioned before, the flicker is considerably worse
when XL and sheet have focus, but still noticeable if the
form is active.

I do not think the entire screen is refreshing. To test,
I created a large rectangle and applied a diagonal dual
gradient effect. Normally when the screen refreshes I
would expect this to flicker. But it doesn't, it's only
the selection border and handles that flicker.

I'm completely baffled! Any more thoughts...?

Thanks and regards,

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