コード例 #1
0
 /// <summary>
 /// Construct new AutoScroll object that will scroll the given target object within it's container
 /// by attaching to the mouse events of the container.
 /// </summary>
 /// <param name="target">The target object to scroll</param>
 /// <param name="zoom">The master MapZoom object that manages the actual render transform</param>
 public MesAutoScroll(IMesContentCanvas target, IMesMapZoom zoom)
 {
     _container             = ((MesContentCanvas)target).Parent as Panel;
     _container.MouseDown  += new MouseButtonEventHandler(OnMouseDown);
     _container.MouseMove  += new MouseEventHandler(OnMouseMove);
     _container.MouseWheel += new MouseWheelEventHandler(OnMouseWheel);
     Keyboard.AddKeyDownHandler(_container, new KeyEventHandler(OnKeyDown));
     _zoom = (MesMapZoom)zoom;
 }
コード例 #2
0
 /// <summary>
 /// Construct new RectangleSelectionGesture object for selecting things in the given target object.
 /// </summary>
 /// <param name="target">A FrameworkElement</param>
 /// <param name="zoom">The MapZoom object that wraps this same target object</param>
 public MesRectangleSelectionGesture(IMesContentCanvas target, IMesMapZoom zoom)
 {
     _target    = (MesContentCanvas)target;
     _container = _target.Parent as Panel;
     if (_container == null)
     {
         throw new ArgumentException("Target object must live in a Panel");
     }
     _zoom = (MesMapZoom)zoom;
     _container.MouseLeftButtonDown += new MouseButtonEventHandler(OnMouseLeftButtonDown);
     _container.MouseLeftButtonUp   += new MouseButtonEventHandler(OnMouseLeftButtonUp);
     _container.MouseMove           += new MouseEventHandler(OnMouseMove);
 }