日期:2014-05-20 浏览次数:21274 次
private void zedGraphControl1_MouseMove(object sender, MouseEventArgs e)
{
// Save the mouse location
PointF mousePt = new PointF(e.X, e.Y);
string tooltip = string.Empty;
// Find the Chart rect that contains the current mouse location
GraphPane pane = ((ZedGraphControl)sender).MasterPane.FindChartRect(mousePt);
// If pane is non-null, we have a valid location. Otherwise, the mouse is not
// within any chart rect.
if (pane != null)
{
double x, y;
// Convert the mouse location to X, and Y scale values
pane.ReverseTransform(mousePt, out x, out y);
// 获取横纵坐标信息
tooltip = "(" + x.ToString("f2") + ", " + y.ToString("f2") + ")";
}
toolTip1.SetToolTip(zedGraphControl1, tooltip);
}