渐变画刷示例
例子代码
1 <Rectangle> 2 <Rectangle.Fill> 3 <LinearGradientBrush> 4 <LinearGradientBrush.StartPoint> 5 <Point X="0" Y="0" /> 6 </LinearGradientBrush.StartPoint> 7 <LinearGradientBrush.EndPoint> 8 <Point X="1" Y="1" /> 9 </LinearGradientBrush.EndPoint> 10 <LinearGradientBrush.GradientStops> 11 <GradientStopCollection> 12 <GradientStop Color="Yellow" Offset="0.0" /> 13 <GradientStop Color="Red" Offset="0.25" /> 14 <GradientStop Color="Blue" Offset="0.75" /> 15 <GradientStop Color="LimeGreen" Offset="1.0" /> 16 </GradientStopCollection> 17 </LinearGradientBrush.GradientStops> 18 </LinearGradientBrush> 19 </Rectangle.Fill> 20 </Rectangle>
LinearGradientBrush.StartPoint:表示渐变方向的起始点,默认是坐标为0,0的点
LinearGradientBrush.EndPoint:表示渐变方向的结束点,默认是坐标为1,1的点,与StartPoint结合起来表示渐变的方向
LinearGradientBrush.GradientStops:GradientStop的集合,描述渐变中过渡点的位置和颜色
posted on 2017-07-26 08:40 alex5211314 阅读(108) 评论(0) 编辑 收藏 举报