Page 1 of 1

Provision to drag the annotation text in annotation tool

Posted: Thu Mar 16, 2006 9:44 am
by 9788742
There should be a feature which will allow the user/client to drag the annotation text (label) and the connecting line should move automatically.
I know that we can stretch/drag the connecting line but there is no way to drag the annotation text.

Thanks

Posted: Fri Mar 17, 2006 10:10 am
by narcis
Hi Lakshmi,

This can actually be easily done doing something like this:

Code: Select all

    private void Form1_Load(object sender, EventArgs e)
    {
      line1.FillSampleValues();
      Bitmap bmp = tChart1.Bitmap; //Trick to force the chart being drawn and annotation arrow being positioned
    }

    private bool StartDrag = false;

    private void annotation1_Click(object sender, MouseEventArgs e)
    {
      StartDrag = !StartDrag;
    }

    private void tChart1_MouseMove(object sender, MouseEventArgs e)
    {
      if (StartDrag)
      {
        annotation1.Left = e.X;
        annotation1.Top = e.Y;
      }
    }

    private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
    {
      annotation1.Callout.Arrow.Visible = true;
      annotation1.Callout.XPosition = line1.CalcXPos(5);
      annotation1.Callout.YPosition = line1.CalcYPos(5);
    }