SelectionTool blocks

7-19-2010 10-10-58 PM.png
As shown in above image, the selection tool puts too many black blocks. Is there a way I can have only at the beginning, middle and at end?

Also, is there a way I can set the transparency of these blocks. Sometimes they are pretty much cover the whole curve that is being selected.
Thanks,

Hi asupriya,

I’m afraid it only can be done manually right now. You could use Selected event to calculate the points to draw and draw them using a Points series or drawing them manually at AfterDraw event.

Yes, check the Selector tool’s property: Brush.Transparency

Can you please post a code snippet for this? I am using fastline series. Appreciate your help.

Hi asupriya ,

Here you have an example to start with:

        private Steema.TeeChart.Tools.Selector select1;
        private Steema.TeeChart.Styles.Line line1;
        private Point[] points;

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

            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line1.FillSampleValues(1000);

            select1 = new Steema.TeeChart.Tools.Selector(tChart1.Chart);
            select1.DrawHandles = false;

            points = new Point[3];
            select1.Selected += new Steema.TeeChart.Tools.SelectorSelectedEventHandler(select1_Selected);

            tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
        }

        void select1_Selected(object sender, EventArgs e)
        {
            if (select1.Selection == line1)
            {
                points[0].X = line1.CalcXPos(0);
                points[0].Y = line1.CalcYPos(0);

                points[1].X = line1.CalcXPos(line1.Count / 2);
                points[1].Y = line1.CalcYPos(line1.Count / 2);

                points[2].X = line1.CalcXPos(line1.Count-1);
                points[2].Y = line1.CalcYPos(line1.Count - 1);
            }
        }

        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            if (select1.Selection == line1)
            {
                int width = 6;
                Steema.TeeChart.Drawing.Graphics3D gd = tChart1.Graphics3D;
                gd.Brush.Color = Color.Red;
                gd.Brush.Transparency = 50;
                
                for (int i = 0; i < points.Length; i++)
                {
                    gd.Rectangle(points[i].X - width, points[i].Y - width, points[i].X + width, points[i].Y + width);    
                }
                
            }
        }

Thanks Yeray for the code snippet. Really appreciate it.

Hi asupriya,

You’re welcome! :slight_smile: