Winform中设置ZedGraph鼠标双击获取距离最近曲线上的点的坐标值
生活随笔
收集整理的這篇文章主要介紹了
Winform中设置ZedGraph鼠标双击获取距离最近曲线上的点的坐标值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
場景
WInforn中設置ZedGraph的焦點顯示坐標格式化以及顯示三個坐標數的解決辦法:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102466190
Winform中實現ZedGraph的多條Y軸(附源碼下載):
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100132245
在多條曲線中,鼠標雙擊面板,彈窗顯示距離焦點最近的坐標的值。
效果
?
注:
博客主頁:
https://blog.csdn.net/badao_liumang_qizhi
關注公眾號
霸道的程序猿
獲取編程相關電子書、教程推送與免費下載。
實現
雙擊事件綁定
zgc.DoubleClickEvent += zgc_DoubleClickEvent;其中zgc
ZedGraphControl zgc實現方法
private static bool zgc_DoubleClickEvent(ZedGraphControl sender, MouseEventArgs e){PointF mousePt = new PointF(e.X, e.Y);CurveItem nearstCurve;int i ;Global.zedGraphControl1.GraphPane.FindNearestPoint(mousePt, out nearstCurve,out i);if (nearstCurve != null && nearstCurve.Points[i]!= null){Double x = nearstCurve.Points[i].X;Double y = nearstCurve.Points[i].Y;string title = Global.zedGraphControl1.GraphPane.XAxis.Title.Text;DevExpress.XtraEditors.XtraMessageBox.Show("索引值:" + i + " X:" + x + " Y:" + y + " Xtitle:" + title);}return true;}?
總結
以上是生活随笔為你收集整理的Winform中设置ZedGraph鼠标双击获取距离最近曲线上的点的坐标值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: WInforn中设置ZedGraph的焦
- 下一篇: C#中将long浮点数格式化为{H:mi