Page 1 of 1

DrawLine Tool clicked event

Posted: Tue Jan 27, 2015 9:46 am
by 9526439
Hi Steema Support,

How to get DrawLine Tool doubleclicked event. Or we can say How to get DrawLine Tool doubleclicked.

Thanks in advance.

Thanks&Regards
PlanoResearch

Re: DrawLine Tool clicked event

Posted: Thu Jan 29, 2015 8:49 am
by narcis
Hi PlanoResearch,

DoubleClick event is not implemented for the DrawLine tool. However, you can easily implement it combining TChart's MouseDown and DoubleClick events as in the code snippet below.

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      FastLine fastLine1 = new FastLine(tChart1.Chart);
      fastLine1.FillSampleValues();

      drawLine1 = new Steema.TeeChart.Tools.DrawLine(tChart1.Chart);
      tChart1.DoubleClick += tChart1_DoubleClick;
      tChart1.MouseDown += tChart1_MouseDown;

    }

    private Steema.TeeChart.Tools.DrawLine drawLine1;
    private Point mousePos;

    void tChart1_MouseDown(object sender, MouseEventArgs e)
    {
      mousePos = new Point(e.X, e.Y);
    }

    void tChart1_DoubleClick(object sender, EventArgs e)
    {
      if (!mousePos.IsEmpty)
      {
        Steema.TeeChart.Tools.DrawLineItem dli = drawLine1.Clicked(mousePos.X, mousePos.Y);
      }
    }