Home All Groups Group Topic Archive Search About

Drawing a line with a gradient fill?

Author
28 Nov 2006 12:44 PM
Robinson
Haven't had much luck googling this one:  I want to draw a line with a
gradient fill, that is a line connecting two shapes in a graphics program,
where each shape is a different colour (say, Red -> Blue).  Now I suppose I
can draw a filled-polygon (rotating it to the correct position to avoid
awkward end-point issues), but I'm wondering if there is any easier way ;).

Thanks,


Robin

Author
28 Nov 2006 1:56 PM
Chris Dunaway
Robinson wrote:
> Haven't had much luck googling this one:  I want to draw a line with a
> gradient fill, that is a line connecting two shapes in a graphics program,
> where each shape is a different colour (say, Red -> Blue).  Now I suppose I
> can draw a filled-polygon (rotating it to the correct position to avoid
> awkward end-point issues), but I'm wondering if there is any easier way ;).

Create a Pen using the constructor that takes a Brush as one of the
argument.  Pass in a LinearGradientBrush for this argument.
Author
28 Nov 2006 5:18 PM
Robinson
> Create a Pen using the constructor that takes a Brush as one of the
> argument.  Pass in a LinearGradientBrush for this argument.

Thanks, that works nicely.