https://stackoverflow.com/questions/12422398/drawing-line-on-a-click-on-zedgraph-pane

public Form1()
    {
        InitializeComponent();
    }        

    PointPairList userClickrList = new PointPairList();
    LineItem userClickCurve = new LineItem("userClickCurve");

    private void zedGraphControl1_MouseClick(object sender, MouseEventArgs e)
    {
        // Create an instance of Graph Pane
        GraphPane myPane = zedGraphControl1.GraphPane;

        // x & y variables to store the axis values
        double xVal;
        double yVal;

        // Clear the previous values if any
        userClickrList.Clear();

        myPane.Legend.IsVisible = false;

        // Use the current mouse locations to get the corresponding 
        // X & Y CO-Ordinates
        myPane.ReverseTransform(e.Location, out xVal, out yVal);

        // Create a list using the above x & y values
        userClickrList.Add(xVal, myPane.YAxis.Scale.Max);
        userClickrList.Add(xVal, myPane.YAxis.Scale.Min);

        // Add a curve
        userClickCurve = myPane.AddCurve(" ", userClickrList, Color.Red, SymbolType.None);

        zedGraphControl1.Refresh();
    }

Drawing line on a click on ZedGraph Pane

you just have to change the userClickList to draw horizontal line.

相关文章:

  • 2021-10-16
  • 2021-12-28
  • 2021-11-06
  • 2021-09-10
  • 2022-02-27
  • 2021-08-12
  • 2021-07-24
猜你喜欢
  • 2021-12-10
  • 2021-11-29
  • 2021-05-31
相关资源
相似解决方案