Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/PanListener.cs @ 1517

Last change on this file since 1517 was 1249, checked in by bspisic, 15 years ago

reimplemented panning and zooming (#424)

File size: 736 bytes
RevLine 
[1055]1using System.Drawing;
2using System.Windows.Forms;
3
4namespace HeuristicLab.Visualization {
5  public class PanListener : IMouseEventListener {
[1249]6    private Point startPoint;
[1055]7
[1249]8    public event MoveHandler Pan;
9    public event MoveHandler PanEnd;
10
11    public PanListener(Point startPoint) {
[1055]12      this.startPoint = startPoint;
13    }
14
15    #region IMouseEventListener Members
16
17    public void MouseMove(object sender, MouseEventArgs e) {
[1249]18      if (Pan != null) {
19        Pan(startPoint, e.Location);
[1055]20      }
21
[1249]22      startPoint = e.Location; 
[1055]23    }
24
25    public void MouseUp(object sender, MouseEventArgs e) {
[1249]26      if(PanEnd != null) {
27        PanEnd(startPoint, e.Location);
[1055]28      }
29    }
30
31    #endregion
32  }
33}
Note: See TracBrowser for help on using the repository browser.