Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net
 Real-Time Graphics Tools for .Net (VB and C#)
 Having trouble with zoom function.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mcgormand

USA
6 Posts

Posted - 05 Jun 2007 :  23:46:28  Show Profile  Reply with Quote
I am trying to use the zoom function in my program. I think I have followed the examples as well as I could. Because I have some normal VB.NET buttons on the bottom of the form these are not Quinn-Curtis buttons. I did have some problems catching the mouse events. I finally was able to catch them in the form code, and send them to OnMouseDown Event to handle the zoom request. This event is now receiving these events, and the event args are now getting passed correctly I believe.

While the mouse event gets caught, I never draw a rubberband line, and nothing happens.

I will attempt to attach the appropiate code below.

Public ZoomObj As ZoomWithStack


Dim pTransform11 = New TimeCoordinates(StartTime, rtTargetData.DefaultMinimumDisplayValue, endTime, _
rtTargetData.DefaultMaximumDisplayValue)
pTransform11.SetGraphBorderDiagonal(0.05, 0.08, 0.95, 0.93)

Dim pTransform22 = New TimeCoordinates(StartTime, rtTargetData.DefaultMinimumDisplayValue, endTime, _
rtTargetData.DefaultMaximumDisplayValue)
pTransform22.SetGraphBorderDiagonal(0.05, 0.08, 0.95, 0.93)

Dim timecoordsarray As TimeCoordinates() = {pTransform11, pTransform22}

ZoomObj = New ZoomWithStack(chartVu, timecoordsarray, True)
ZoomObj.SetButtonMask(MouseButtons.Left)
ZoomObj.SetZoomYEnable(True)
ZoomObj.SetZoomXEnable(True)
ZoomObj.SetZoomXRoundMode(ChartObj.AUTOAXES_FAR)
ZoomObj.SetZoomYRoundMode(ChartObj.AUTOAXES_FAR)
ZoomObj.SetEnable(True)
ZoomObj.SetZoomStackEnable(True)
chartVu.SetCurrentMouseListener(ZoomObj)

Public Class ZoomWithStack
Inherits ChartZoom
'Public zoomObj As ZoomWithStack

Public Sub New(ByVal component As ChartView, ByVal transforms() As TimeCoordinates, ByVal brescale As Boolean)
MyBase.new(component, transforms, brescale)
End Sub
Public Overrides Sub OnMouseDown(ByVal mouseevent As System.Windows.Forms.MouseEventArgs)
If ((mouseevent.Button And MouseButtons.Right) <> 0) Then
Me.PopZoomStack()
Else
MyBase.OnMouseDown(mouseevent) 'If I put a break point here, it gets here, and mouseevent does contain the args.
End If

End Sub 'OnMouseDown
End Class 'ZoomWithStack

'The following is because this sits on a form, that has standard windows buttons on it, and I need to catch the OnMouseDown event for that form, and pass it on to the Overide above.

Private Sub frmRunPrograms_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles _ MyBase.MouseDown
If Not IsNothing(ChartWindow) Then
ZoomObj.OnMouseDown(e)
End If
If Not IsNothing(RePrintWindow) Then
ZoomObj.OnMouseDown(e)
End If
If Not IsNothing(ViewXmlWindow) Then
ZoomObj.OnMouseDown(e)
End If
If Not IsNothing(RunWindow) Then
ZoomObj.OnMouseDown(e)
End If
End Sub


I could send you the whole project, but the only thing is that this project requires MSDE to be installed, and a DB created and configured correctly. If needed, I can send the necessary stuff to do that and the rest of the project. The only differance I can tell is that I did have to catch the OnMouseDown event on the form, and pass it to the zoomobj.OnMouseDown event. My ZoomObj is public, as well as Public Class ZoomWithStack and Public Overrides Sub OnMouseDown not sure if that means anything or not.

What should I try now?




quinncurtis

1586 Posts

Posted - 06 Jun 2007 :  09:35:18  Show Profile  Reply with Quote
We don't know why you would need to explicity pass on mouse events to the ChartZoom object in order to get the ChartZoom to work in combination with a simple .Net Button. Also, we don't know why you are intercepting the Forms MouseDown event in order to process a button.

If you want to see a standard .Net button added to a ChartView, look at our MultipleAxes.MultipleAxesChart example program. That uses several .Net buttons added to our ChartView. The button processing routine looks like:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        RescaleAxes(25)
    End Sub



The button processing does not require the programmer to override the OnMouseDown event. In that example the .Net buttons co-exist with our data tooltip, which have a mouse interface very similar to that of the ChartZoom class. Also, we replaced the data tooltip with zooming and that also worked.

You should try and reproduce your problem using one of our simple example programs. Add a .Net button to our ZoomExamples.SimpleZoom example program and see if you can reproduce your problem.

Last, assuming that for some reason we don't understand, you do need to intercept the mouse events and pass them on the ChartZoom object, perhaps you need to do that with the other two that ChartZoom uses: OnMouseMove and OnMouseUp. If those events don't get through to the ChartZoom object, nothing will happen when you zoom.
Go to Top of Page

mcgormand

USA
6 Posts

Posted - 07 Jun 2007 :  21:06:56  Show Profile  Reply with Quote
Well, there may be other ways to do it, but this application is already been released to the first few customers, and the way I have it, the windows form does grab and swallow mouse events. Your final answer is the correct one for me, I just had to also pass on the OnMouseMove and OnMouseUp events to the zoom object, and it now works fine. Since I originally have a custom axis scales, is there an easy way to tell when I have popped the stack back to the original state? That way, I can turn off the autoscaling and put back my custom axis. Thanks,
mcgormand
Go to Top of Page

mcgormand

USA
6 Posts

Posted - 07 Jun 2007 :  21:46:32  Show Profile  Reply with Quote
After a little checking, I found that I just need to check the return value from PopZoomStack(), so I no longer need that information. I should be able to finish from here.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07