Line | |
---|
1 | using System.Drawing;
|
---|
2 | using System.Windows.Forms;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.Visualization {
|
---|
5 | /// <summary>
|
---|
6 | /// Supports the state panning.
|
---|
7 | /// </summary>
|
---|
8 | public class PanListener : IMouseEventListener {
|
---|
9 | private Point startPoint;
|
---|
10 |
|
---|
11 | /// <summary>
|
---|
12 | /// This event will be fired every MouseMove call.
|
---|
13 | /// </summary>
|
---|
14 | public event MoveHandler Pan;
|
---|
15 |
|
---|
16 | public PanListener(Point startPoint) {
|
---|
17 | this.startPoint = startPoint;
|
---|
18 | }
|
---|
19 |
|
---|
20 | #region IMouseEventListener Members
|
---|
21 |
|
---|
22 | public void MouseMove(object sender, MouseEventArgs e) {
|
---|
23 | if (Pan != null) {
|
---|
24 | Pan(startPoint, e.Location);
|
---|
25 | }
|
---|
26 |
|
---|
27 | startPoint = e.Location;
|
---|
28 | }
|
---|
29 |
|
---|
30 | public void MouseUp(object sender, MouseEventArgs e) {}
|
---|
31 |
|
---|
32 | #endregion
|
---|
33 | }
|
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.