0
Transparent without colour problem
This discussion was imported from CodePlex
duongthaiha wrote at 2013-05-01 12:42:
Hi
I am new to Helix and trying to create a simple box with transparent at run time with C#. I can see the box showing with transparency but there is no colour on the box. I dont know if i did anything wrong in my small piece of code:
Best regards
I am new to Helix and trying to create a simple box with transparent at run time with C#. I can see the box showing with transparency but there is no colour on the box. I dont know if i did anything wrong in my small piece of code:
Objects = new ObservableCollection<Visual3D>();
Objects.Add(new GridLinesVisual3D());
var color = Color.FromArgb(0x80, Colors.Red.R, Colors.Red.G, Colors.Red.B);
var b = new BoxVisual3D()
{
Width = 10,
Length = 10,
Height = 10,
};
var brush = new SolidColorBrush();
brush.Color = color;
b.Fill = brush;
Objects.Add(b);
Thank you very much in advance.Best regards
objo wrote at 2013-05-08 15:37:
- Did you add lights to your model?
- I checked the
BoxVisual3D
class with
<ht:BoxVisual3D Width="10" Height="10" Length="10" Fill="#80FF0000"/>
and this works fine Note that you cannot get 100% correct visualization of transparency for a box in WPF...
You could also use the
ChangeAlpha
extension method: b.Fill = new SolidColorBrush(Colors.Red.ChangeAlpha(0x80))
Customer support service by UserEcho