Controlling flicker in mouse move events

J

John Coleman

Greetings,
In a class I am currently teaching we are about to talk about
gradient vectors. I prepared an XY scatter-chart whose background was
set to be a contour-map of a function of 2 variables. I wrote a
mouse-move event handler which draws the gradient to the surface at
that point. After I was finally able to find a way to translate from
the annoying "client coordinates" returned by the mouse move event into
the coordinate system determined by the chart axis, I was able to get
it to work as I intended. The problem is - flicker! Big time. I've
tried things like briefly turning off screen updating, etc. But nothing
seems to work. From this group I downloaded a function to wrap an API
call to LockWindows (or something like that), but it didn't seem much
better than toggling screen-updating. In frustration, I turned it into
a mouse-down event. I can still move around the contour, clicking here
and there to display the gradient, but it now lacks the animation which
would be have been cool. Is there a work around or is this just an
unavoidable by-product of the fact that Excel wasn't designed for
animation?

Thanks in advance

-John Coleman
 
G

Guest

John,

I suggest, instead of using mouse_move, to make the code a standard macro
and assign the macro to a keyboard key by means of Application.OnKey. When
you hold down the key it should repeatedly execute the macro. Based on very
limited experience, it is smoother than mouse-move and obviously has the
advantage of easily being turned-off (let go the key).

Note that I only suspect it will work. I have no experience other than with
a much simpler scenario. Interested in the outcome pro or con.

Regards,
Greg
 

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