GoToolPanning and ASP.NET

By chance is there a sample somewhere demonstrating how to pan in GoWeb?

I want to be able to drag the background layer of my view around in a web page, if possible.


By default users can pan a GoWeb.GoView by just dragging with the middle mouse button, if it starts in the background of the view. That’s because the standard automatic panning tool that is used for Windows Forms can’t work in Web Forms, since it can’t be as interactive. So we modified GoToolPanning for Web Forms to be a manual pan (i.e. GoToolPanning.AutoPan defaults to false) and so that it is just a middle mouse button drag.
You can change the policies by overriding GoToolPanning.CanStart. For example:
public class MyManualPanningTool : GoToolPanning {
public MyManualPanningTool(GoView view) : base(view) {
this.AutoPan = false;
this.Modal = false;
public override bool CanStart() {
GoInputEventArgs e = this.LastInput;
// ignore if button is modified
if (e.Alt || e.Control || e.Shift) return false;
// only with left mouse button
if (e.Buttons != MouseButtons.Left) return false;
// can’t start if we’re over an object in the document
GoObject obj = this.View.PickObject(true, true, e.DocPoint, true);
return (obj == null);
To install this tool:
MyView.MouseMoveTools.Add(new MyManualPanningTool(MyView));
But for this to work, you’ll need to remove the rubber-band selection tool, which would otherwise take precedence. Also, the predefined panning tool is probably useless, so we’ll remove that too:
MyView.ReplaceMouseTool(typeof(GoToolPanning), null);
MyView.ReplaceMouseTool(typeof(GoToolRubberBanding), null);