专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > .NET报表

zedgraph获取鼠标位置坐标解决方案

发布时间:2011-06-24 21:41:57 文章来源:www.iduyao.cn 采编人员:星星草
zedgraph获取鼠标位置坐标
我用zedgraph画了许多等值线,希望随着鼠标的移动获得横纵坐标(没有画点的位置也希望能取得到),但是怎么都没做到,求指教~!

------解决方案--------------------
或者:
C# code

        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);
        }
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: