Change Line color?

Oct 13, 2010 at 9:40 PM

Is it possible to programmatically change the color of a line after it's created?  I've tried doing this in an event handler:

this.line.Color = new Color(255, 0, 0, 0);
but it seems to have no effect on what gets rendered.
Oct 15, 2010 at 1:31 PM

Were do you have your line? 

Is it within a Geometry?

If it is, what you need to do when changing properties on it is to call the SetLine() method on the particular GeometryDetailLevel (FullDetailLevel). 
The reason for this is that the generic line is not the same as the line used in the renderer. 

Oct 15, 2010 at 8:56 PM

It is within a geometry.  The only thing I seem to be able to do is set the color of the entire geometry, but if I try to set the color of an individual line, it doesn't work.  For example, inside the geometry class:

this works:  (Makes my lines yellow)

public override void Prepare(Viewport viewport)

            this.Color = new Color(255, 255, 0, 255);

this doesn't:  (Line does not turn red)

private void GenerateLines()

            this.lines[0] = new Line(0, 1);
            this.lines[0].Color = new Balder.Color(255, 0, 0, 255);

            FullDetailLevel.SetLine(0, this.lines[0]);

            // Do the same for the other 11 lines
Oct 15, 2010 at 9:24 PM

Sorry for the mislead - you're absolutely right. It uses the objects color. 

Oct 15, 2010 at 9:24 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 15, 2010 at 9:44 PM

You know what - it was a two liner (actually 4), worth of work - so I put it in :

Oct 16, 2010 at 12:12 AM

Works great now.  Thanks!