Page 1 of 1

SurfaceNearestTool with ColorGrid

Posted: Fri Jul 06, 2007 8:29 am
by 13045625
Dear All

I would like to add something like the SurfaceNearestTool with a ColorGrid series. Is this possible? (I've tried to get it to work but program crashes when I select a cell on the ColorGrid). If not possible can someone suggest the best approach to achieve a similar effect (e.g. draw custom shape on the chart?). I would like to highlight just the selected cell, not the whole column and row. Also with the SurfaceNearestTool I couldn't find how to set the Column Color to clNone (I couldn't find where clNone is defined).

Regards

jenb

Posted: Fri Jul 06, 2007 10:06 am
by 9348258
Hi Jenb

The SurfaceNearestTool doesn't work with ColorGrid Series, I've added it (TF02012323) in our wish list to be fixed for future release.

In the meantime, you can use the method clicked in the MouseMove event of the chart, as below code. But method clicked of the ColorGrid Series doesn't work to the perfection, I've added it (TF02012324) to our defect list to be fixed for future releases.

Code: Select all

private void Form1_Load(object sender, EventArgs e)
        {
            tChart1.Aspect.View3D = false;
            colorGrid1.FillSampleValues(16);
        }

        private int tmpIndex;
        private Color tmpColor;

        private void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            int index = colorGrid1.Clicked(e.X, e.Y);
            if (index != -1)
            {
                tmpColor = colorGrid1.Colors[index];
                colorGrid1.Colors[index] = Color.Tomato;
                colorGrid1.Colors[tmpIndex] = tmpColor;
                tmpIndex = index;               
            }
            colorGrid1.Repaint();
        }

Posted: Fri Jul 06, 2007 12:01 pm
by 13045625
Thanks Edu

For now I'm using the Cursor Tool, it's not exactly what I want, but not a bad work-around.

jenb