Hi All
I have created a very handy mouse zoom routine for excel charts that makes a selection rectangle follow the mouse and then zooms in on the selected area. Microsoft should have provided this feature long ago, but now I have done it.
My problem is that, when the mouse button is pressed (as in a drag and drop) my mouse move event sub doesn't fire. It works fine when I release the mouse button. The following code in a class module shows what I have written:
Public WithEvents EvtChart As Chart
'this event routine is used for the Zoom function
'if zoom has been initialized, this sub captures the mouse click and calls the zoom functions
Private Sub EvtChart_MouseDown(ByVal Button As Long, ByVal shift As Long, ByVal X As Long, ByVal Y As Long)
If Button = 1 Then
If Zoom = False Then
Call save_XY(X, Y)
ElseIf Zoom = True Then
Call RescaleChart(X, Y)
End If
End If
End Sub
'this event routine is used for the Zoom function
'this sub captures mouse movement to form the selection rectangle. Right now, it doesn't work when the mouse button is down.
Private Sub EvtChart_MouseMove(ByVal Button As Long, ByVal shift As Long, ByVal X As Long, ByVal Y As Long)
If X1 > 0 And Y1 > 0 Then Call ResizeRectangle(X, Y)
End Sub
Does anyone understand this problem? I also want to make a pan routine but want to hold the mouse button while dragging.
Bookmarks