Zoom like Overview


#1

Hi,
need help with zooming… Have a view and don’t want to use an overview for zooming action. Want to have such a rect like in the overview. When the user clicks and draws the rect, the rect should be the new zoomed view…any ideas? Maybe there’s a chance to use the rectangle from the overview, but i’m not experienced enough
please help…thanx

M.D.


#2
Are you using GoToolZooming? I think all you need to do is: myView.ReplaceMouseTool(typeof(GoToolRubberBanding), new GoToolZooming(myView));

#3

thank you for the tip…

…i tried this, but nothing happend after i click with the mouse on the background and release it after moving.
The view just reloads in the same state as before. I subclassed the
GoToolZooming-class, when i debug the app, i can get a rectangle that
is the one i was drawing on the view:

public override void DoRubberBand(System.Drawing.Rectangle box)
{
base.DoRubberBand (box);
}

and this box is just the rect that i want to be my new zoomed clip of the actual view…
…do you have an idea?:)


#4

This was puzzling, until I realized that this was another case of a GoView reference not having been loaded properly when the page is loaded from the deserialized view/selection/document/layers/objects. Basically the GoToolZooming.ZoomedView reference was pointing at the deserialized view instead of the new view constructed as part of the Page.
So, in the Page Init event handler, we need to modify the set of tools as before, but also register a GoView.Load event handler:
MyView.ReplaceMouseTool(typeof(GoToolRubberBanding), new GoToolZooming(MyView));
MyView.Load += new EventHandler(MyView_Load);
And define the GoView.Load event handler to update the reference to the GoView:
void MyView_Load(Object sender, EventArgs e) {
GoToolZooming z = MyView.FindMouseTool(typeof(GoToolZooming)) as GoToolZooming;
if (z != null) z.ZoomedView = MyView;
}
Maybe there’s a way for us to fix the reference automatically, so that you don’t need to.


#5

We’ll fix those GoView references automatically, in version 2.2.