Zooming

please help me solve this one : I got 2 goview diagrams open in a MDI application on diagram 1 I zoom in in with the mousewheel on a object, when I switch to diagram 2 and back to diagram 1 the diagram zoomed out again. how can I make the diagrams to stay on the zoomed level when I am switching windows?

You should be able to… set breakpoints at all the places you set DocScale / RescaleToFit / RescaleWithCenter in your code to see if it is something happening that you don’t expect.

In other words, each GoView has its own GoView.DocScale property.

Perhaps some event handler of yours is setting the DocScale property for both of the views.

I cant find any code that modify my DocScale,could it be that it behaves like this because of the GoDrawView control?

ok, try this. Set up and Event Handler for PropertyChanged on your GoView, and set a breakpoint there.

It would look something like this:
private void goView1_PropertyChanged(object sender, PropertyChangedEventArgs e) {
if (e.PropertyName == "DocScale")
toolStripStatusLabel1.Text = this.goView1.DocScale.ToString();
}
Set a breakpoint there, and look up the stack to see who is changing the DocScale.

It look like it is when the windowposchanged. is there any way I can prvent this?

Are you swapping one GoView for another? Is that why you are changing the window position?

I got two windows with a goview on, the windows is in tab controls, as i swap back and forth between the windows if resize itself. I also have dockable tabs in the windows and as soon as I undock or dock the tabs the resize event is fired. Any solutions?

RescaleWithCenter is being called in UpdateExtent because you must have GoView.SheetStyle set to something other than GoViewSheetStyle.None.

I'm still not clear on your application setup to understand why the GoView control is having its own size set when you switch windows.
But GoDiagram is doing what it is supposed to be doing, given the way you have SheetStyle set.

hi Jake - you are correct my GoDrawview is in the following mode
Me.myView.SheetStyle = Northwoods.Go.GoViewSheetStyle.Sheet

and I realiize that GoDiagram is behaving correctly, in this case I need to keep the Goview in the "Zoomed" mode as soon as the user switch tabs or undock a window. the user is working on a A2 sheet and it is very frustrating if the goview try to do the rescale.
example of my dockwindow:

Jake - I am not sure if it is the correct way to do it, I added the following code:

Public Overrides Sub RescaleWithCenter(ByVal newscale As Single, ByVal docPt As System.Drawing.PointF) ' MyBase.RescaleWithCenter(newscale, docPt) End Sub
Is this the best way to stop rescalling?

Actually, GoView.UpdateExtent is what is responsible for deciding the appropriate behavior whenever the view’s size has changed.

When GoView.SheetStyle is not None, that method calls RescaleWithCenter to carry out the standard behavior.

So although it might work fine in your case, it might be “better” to override UpdateExtent instead, and have it be a no-op if some new flag of yours is set. That way you and other code can still call RescaleWithCenter whenever needed.