Last change
on this file since 2608 was
1883,
checked in by dwagner, 15 years ago
|
Bug fix: No marker on first added value (#581)
New feature: Tooltip, which shows the world-values on mouseover event of a datapoint. (#638)
New feature: New Linetype Points, which is a line consisting only of the markers (#637)
|
File size:
1.1 KB
|
Rev | Line | |
---|
[1883] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Drawing;
|
---|
| 4 | using System.Linq;
|
---|
| 5 | using System.Text;
|
---|
| 6 | using System.Windows.Forms;
|
---|
| 7 |
|
---|
| 8 | namespace HeuristicLab.Visualization {
|
---|
| 9 | class TooltipListener:IMouseEventListener {
|
---|
| 10 | public delegate void ShowToolTipHandler(Point location);
|
---|
| 11 |
|
---|
| 12 | public event ShowToolTipHandler ShowToolTip;
|
---|
| 13 |
|
---|
| 14 | private readonly Timer timer;
|
---|
| 15 | private Point lastMouseLocation;
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | public TooltipListener() {
|
---|
| 19 | timer= new Timer {Interval = 300};
|
---|
| 20 | timer.Tick += Tick;
|
---|
| 21 | timer.Start();
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | private void Tick(object sender, EventArgs e) {
|
---|
| 25 | if(ShowToolTip != null) {
|
---|
| 26 | ShowToolTip(lastMouseLocation);
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | #region Implementation of IMouseEventListener
|
---|
| 31 |
|
---|
| 32 | public void MouseMove(object sender, MouseEventArgs e) {
|
---|
| 33 | if(e.Location==lastMouseLocation)
|
---|
| 34 | return;
|
---|
| 35 | timer.Stop();
|
---|
| 36 | timer.Start();
|
---|
| 37 | lastMouseLocation = e.Location;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | public void MouseUp(object sender, MouseEventArgs e) {
|
---|
| 41 | //Not needed, so do Nothing
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | #endregion
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.