- 窗体颜色变换
<Grid.Background>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.00" Color="Red"></GradientStop>
<GradientStop Offset="0.3" Color="Beige"></GradientStop>
<GradientStop Offset="0.50" Color="Indigo"></GradientStop>
<GradientStop Offset="0.8" Color="BlanchedAlmond"></GradientStop>
<GradientStop Offset="1.00" Color="Violet"></GradientStop>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Grid.Background>
LinearGradientBrush brush = new LinearGradientBrush();
GradientStop stop1 = new GradientStop(Colors.Red, 0.1);
brush.GradientStops.Add(stop1);
GradientStop stop2 = new GradientStop(Colors.Plum, 0.3);
brush.GradientStops.Add(stop2);
GradientStop stop3 = new GradientStop(Colors.PowderBlue, 0.5);
brush.GradientStops.Add(stop3);
gdTest.Background = brush;