0
Rectangles are not drawn of specified Colors !!!!
This discussion was imported from CodePlex
terry_513 wrote at 2014-01-29 11:16:
I need to draw N vertical parts. So, I draw rectangles specifying its parameters & different colors for each part.
RECT LEN = 12.2586666666667RECT LEN = 0.202133333333333RECT LEN = 11.5825333333333RECT LEN = 0.157333333333333RECT LEN = 19.9297333333333RECT LEN = 0.15733333333333RECT LEN = 17.8796666666667RECT LEN = 0.157399999999992
I know I have set rect.Width = sec.Length which sould be set for rect.Length. But with that setting, I was getting rectangle vertically long the length is smaller than width. I couldn't get why was getting that results also.
Any idea, why the rectangles are not shown of specified colors and of black & white colors !!!!
This is mainly to get the background effect. Each section tells something different.
Any help is highly appreciated.
Thanks
private void DrawSections()
{
double x = 0, y = 0;
int i=0;
SolidColorBrush[] brushes = new SolidColorBrush[]{Brushes.Red, Brushes.Purple, Brushes.Gold, Brushes.Green, Brushes.YellowGreen, Brushes.Turquoise, Brushes.Wheat, Brushes.Pink, Brushes.PaleVioletRed, Brushes.Olive};
foreach (Section sec in areasList_Scaled)
{
RectangleVisual3D rect = new RectangleVisual3D();
rect.Origin = new Point3D(x, y, 0);
rect.Length = 120;
rect.Width = sec.Length; // myRect.Width;
//rect.Fill = Brushes.Lavender; // new SolidColorBrush(Colors.LightCoral);
rect.Material = new DiffuseMaterial(brushes[i]);
i++;
Console.Write("RECT LEN = " + sec.Length);
y += sec.Length;
wellViewport.Children.Add(rect);
}
}
With this code, I get rectangles, but not of the specified colors - instead of black & white colors. The Length of each sections is like
RECT LEN = 12.2586666666667RECT LEN = 0.202133333333333RECT LEN = 11.5825333333333RECT LEN = 0.157333333333333RECT LEN = 19.9297333333333RECT LEN = 0.15733333333333RECT LEN = 17.8796666666667RECT LEN = 0.157399999999992
I know I have set rect.Width = sec.Length which sould be set for rect.Length. But with that setting, I was getting rectangle vertically long the length is smaller than width. I couldn't get why was getting that results also.
Any idea, why the rectangles are not shown of specified colors and of black & white colors !!!!
This is mainly to get the background effect. Each section tells something different.
Any help is highly appreciated.
Thanks
objo wrote at 2014-01-29 19:49:
Did you add lights to your scene?
terry_513 wrote at 2014-01-30 06:55:
Oh yes, I hadn't added lights. Had no idea that, without lights 3D colors are not visible !!!!.
Added lights and now it shows properly.
I need to add background to rectangles of image. Can you suggest any link or article that can help me or you provide an example for the same.
Thanks a lot.
Added lights and now it shows properly.
I need to add background to rectangles of image. Can you suggest any link or article that can help me or you provide an example for the same.
Thanks a lot.
Customer support service by UserEcho