Scenes
Winforn ZedGraph set the properties of the graph, the axis attributes Scale Properties:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100112573
Get latest coordinates of points on the curve and the curve when the mouse passes near the curve, and thus the ordinate represents a cross.
effect
Note:
Blog home page:
https://blog.csdn.net/badao_liumang_qizhi
public concern number of
programs overbearing ape
acquisition-related programming e-books, tutorials and push for free download.
achieve
Binding mouse motion events
zgc.MouseMove += zgc_MouseMove;
Zgc which is ZedGraphControl zgc
Private static void zgc_MouseMove ( Object SENDER, The MouseEventArgs E) { the using (Graphics GC = Global.zedGraphControl1.CreateGraphics ()) the using (PEN = Pen new new Pen (Color.green)) { // set the brush width pen.Width = . 1 ; pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot; RectangleF RECT = Global.zedGraphControl1.GraphPane.Chart.Rect; // make sure the drawing area IF (rect.Contains (e.Location)) { Global.zedGraphControl1.Refresh (); // draw a vertical line gc.DrawLine (PEN, eX, rect.top, eX, rect.bottom); // draw a horizontal line gc.DrawLine (pen, rect.Left, eY, rect .right, eY); } } }
Note:
Global.zedGraphControl1 is zedGraphControl target global domain.
After this move will produce crosshair with the mouse, but when they leave pane how to draw a good cross hairs removed.
Bind it to remove the mouse event
zgc.MouseLeave += zgc_MouseLeave;
Implementation
Private static void zgc_MouseLeave ( Object SENDER, EventArgs E) { the using (Graphics GC = Global.zedGraphControl1.CreateGraphics ()) the using (PEN = Pen new new Pen (Color.green)) { // set the brush width pen.Width = . 1 ; pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot; RectangleF RECT = Global.zedGraphControl1.GraphPane.Chart.Rect; // make sure the drawing area, Global.zedGraphControl1.Refresh (); // draw a vertical line gc.DrawLine (PEN, 0 , 0 , 0 , 0 ); // draw a horizontal line gc.DrawLine (PEN, 0 , 0 , 0 , 0 ); } }
Here is the method adopted by way of a line drawn from the origin make it disappear.