Page 1 of 1

"map1.Shapes[index].Pen.Color = customclr" does no

Posted: Thu Mar 16, 2006 9:06 am
by 9788742
I am using a map series.
And adding various shapes in the map series using polygon class. See the below code:

Code: Select all

        private void PlotCurve(ArrayList coordinates, Color clr)
        {
            Polygon pgon = null;
            int count = coordinates.Count;
            for (int i = 0; i < count; )
            {
                pgon = new Polygon (map1.Shapes, tChart1.Chart);
                double[] values =(double[])coordinates[i];
                pgon.Add(values[0], values[1]);
                ++i;
                if(i<count)
                {
                    values =(double[])coordinates[i];
                    pgon.Add(values[0], values[1]);
                }
                ++i;
                if(i<count)
                {
                    values =(double[])coordinates[i];
                    pgon.Add(values[0], values[1]);
                    int index = map1.Shapes.Add(pgon);	
                    map1.ColorEach = true;
                    map1.Shapes[index].ParentBrush=false;
                    map1.Shapes[index].Color = clr;
                    map1.Shapes[index].Pen.Color = clr;
                   
                    --i;
                }
            }            
 
I wish to draw each shape's border with different pen color and hence I use the code:
map1.Shapes[index].Pen.Color = clr;
But this does not seem to do anything.
Instead if i use:
map1.Pen.Color it works, but that does not serve my purpose since all the shapes added will have the same color.

How to get around this problem?

Thanks

Posted: Mon Mar 20, 2006 3:09 pm
by narcis
Hi Lakshmi,

I'm afraid this is not currently possible. I've added your request to our wish-list to be considered for inclusion in future releases.

Posted: Wed Mar 22, 2006 8:48 am
by narcis
Hi Lakshmi,

Sorry but a colleague told me that it could be achieved doing something like:

Code: Select all

			for(int i=0;i<map1.Shapes.Count;++i)
			{
				map1.Shapes[i].ParentPen=false;
				map1.Shapes[i].ParentBrush=false;
				map1.Shapes[i].Pen.Color=Color.FromArgb(50+i*4,50+i*4,50+i*4);
				map1.Shapes[i].Brush.Color=Color.FromArgb(50+i*4,50+i*4,50+i*4);
				map1.Shapes[i].Pen.Width=2;
			}