您的位置:首页 > 其它

zedgraph控件怎么取得鼠标位置的坐标值(转帖)

2015-01-09 09:42 323 查看
我想取得zedgraph控件上任意鼠标位置的坐标值,IsShowCursorValues可以显示鼠标位置的值但是不能提取赋值给其他的变量。用PointValueEvent这个事件又只能得到已经画出的点的坐标,而我想得到任意位置的坐标。

c.MouseDownEvent += new ZedGraphControl.ZedMouseEventHandler(myMouseDown);
protected bool myMouseDown(object sender, MouseEventArgs e)
{
pDown.X = e.X;
pDown.Y = e.Y;
return true;
}



private void zedGraph1_MouseClick(object sender, MouseEventArgs e)
{
PointF mousePt = new PointF(e.X, e.Y);
GraphPane pane = ((ZedGraphControl)sender).MasterPane.FindChartRect(mousePt);

if (pane != null)
{
double x, y;
pane.ReverseTransform(mousePt, out x, out y);
MessageBox.Show(x+""+y);
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: