Page 1 of 1

Clearing Drawline Handles after Delete

Posted: Sun Jul 01, 2012 3:43 am
by 15660116
I am having trouble clearing drawline handles after deleting a selected line.

For example:

DrawLine1.Lines.Remove(DrawLine1.Lines.Item(NumLine))
Tchart1.Redraw

This will delete the line but leaves the drawline handles on the canvas, if the line has been selected.

Is there another way to clear the line and handles?

Can I clear all selections before deleting the line?

Drawline.DeleteSelected() is not suitable for my purpose, as the line I want to delete is not always the selected line.

Is this a bug?

Re: Clearing Drawline Handles after Delete

Posted: Thu Jul 05, 2012 3:26 pm
by 10050769
Hello lilo,

I inform you I have added your problem with Remove DrawLine, in the bug list report with number[TF02016242]. We will try to fix it upcoming maintenance releases. On the other hand, I think you can use DeleteSelected() as a workaround as do in next lines of code:

Code: Select all

 public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.Line Series1;
        Steema.TeeChart.Tools.DrawLine drawLine1;
        private void InitializeChart()
        { //InitializeChart
            tChart1.Aspect.View3D = false;
            //Series
            Series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            this.Series1.FillSampleValues();
            //Tool
            drawLine1 = new DrawLine(tChart1.Chart);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Boolean [] deletLine = new Boolean[drawLine1.Lines.Count];
            for (int i = 0; i < drawLine1.Lines.Count; i++)
            {
                if (i % 3 == 0)
                {

                    deletLine[i] = true;
                }
                else
                {
                    deletLine[i] = false;
                }
            }
            //Tool
            Steema.TeeChart.Tools.DrawLineItem drawlineItem1 = drawLine1.Lines[0];
            //Save DrawLineItem;
            drawLine1.Selected = drawlineItem1;
            for (int i = 0; i < drawLine1.Lines.Count; i++ )
            {
                Steema.TeeChart.Tools.DrawLineItem I = drawLine1.Lines[i];
                if (deletLine[i])
                {
                    if (I != drawlineItem1)
                    {
                        drawLine1.Selected = I;
                        drawLine1.DeleteSelected();
                    }
                    else { drawLine1.DeleteSelected(); }
                }
            }
        }
Can you tell us if previous code works as you expected?
Thanks,

Re: Clearing Drawline Handles after Delete

Posted: Fri Jul 06, 2012 6:31 am
by 15660116
Thanks Sandra,

Your workaround contains some clues how to fix the problem. Now working fine.

Re: Clearing Drawline Handles after Delete

Posted: Fri Jul 06, 2012 7:16 am
by 10050769
Hello lilo,

I am glad that my solution helps you.

Thanks,

Re: Clearing Drawline Handles after Delete

Posted: Wed Sep 19, 2012 10:50 am
by 10050769
Hello lilo,

I inform you that the bug number [TF02016242] isn't a bug, because you can solve the problem with the handles, setting the DrawLine.Selected to null as do in next code:

Code: Select all

    public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.Line Series1;
        Steema.TeeChart.Tools.DrawLine drawLine1;
        private void InitializeChart()
        { //InitializeChart
            tChart1.Aspect.View3D = false;
            //Series
            Series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            this.Series1.FillSampleValues();
            //Tool
            drawLine1 = new Steema.TeeChart.Tools.DrawLine(tChart1.Chart);
        }
        private void button1_Click(object sender, EventArgs e)
        {

            if (drawLine1.Lines.Count != 0)
            {
                if (drawLine1.Lines.Count > 1)
                {
                    Steema.TeeChart.Tools.DrawLineItem I = drawLine1.Selected;
                    drawLine1.Lines.Remove(I);
                    drawLine1.Selected = null;
                    
                }
                else
                {
                    drawLine1.Lines.Remove(drawLine1.Lines[0]);

                }
            }
        }
I hope will helps.

Thanks,