How can I stroke a Polygon along all the segments of it?

Dear all

I want to stroke a Polygon from red to blue along all the segments of it. e.g. start from the beginging segment with red, along the next segment which is connected with the previous one, the color will change smoothly, and so on... till the end segment of Polygon with blue.

The Ploygon is very complex, maybe like a ZigZag, maybe are crossed with each other....

I tried to used LinearGradientBrush and RadialGradientBrush do not work....

Is there any easy method?

thanks~~~

[890 byte] By [StrongZhu] at [2008-1-7]
# 1

en...

I need to stroke an array of Bezier lines one by one, with gradient......

StrongZhu at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2

Hello, I think you’ll have to compute the colors yourself. No build in Gradient Brushes provide this functionality… You can use several Paths to create your Polygon instead of one. For example, if you have 6 segments, then you’ll need 6 Paths. For each Path, you can set its Stroke based on you calculation, for example, the first one 255,0,0, the second one 255-255/6=212.5,0,255/6=42.5, etc…

Yi-LunLuo-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified