Silverlight(9) - 2.0画笔之SolidColorBrush, ImageBrush, VideoBrush, LinearGradientBrush, RadialGradientBrush
2008-11-14 11:50:38 来源:WEB开发网5、RadialGradientBrush.xaml
<UserControl x:Class="Silverlight20.Brush.RadialGradientBrush"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Left">
<Grid Margin="10">
<Rectangle Width="200" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top">
<Rectangle.Fill>
<!--LinearGradientBrush - 放射性渐变画笔-->
<!--
GradientOrigin - 放射性渐变的 放射源的 原点坐标。默认值0.5,0.5
Center - 放射性渐变的 填充范围(红色圆圈部分)的 原点坐标。默认值0.5,0.5
GradientStop - 渐变中,过渡点的设置。参见:Brush/LinearGradientBrush.xaml
ColorInterpolationMode - 插入渐变颜色的方式 [System.Windows.Media.ColorInterpolationMode枚举]。参见:Brush/LinearGradientBrush.xaml
SpreadMethod - 线性渐变线之外, 输出区域之内的渐变方式 [System.Windows.Media.GradientSpreadMethod枚举]。。参见:Brush/LinearGradientBrush.xaml
-->
<RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5">
<GradientStop Color="Red" Offset="0.0" />
<GradientStop Color="Green" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="Yellow" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path Stroke="Red" StrokeThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top">
<Path.Data>
<EllipseGeometry Center="100,50" RadiusX="100" RadiusY="50" />
</Path.Data>
</Path>
</Grid>
<Grid Margin="10">
<Rectangle Width="200" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top">
<Rectangle.Fill>
<!--
RadiusX - 填充范围的 X 轴半径。默认值0.5
RadiusY - 填充范围的 Y 轴半径。默认值0.5
-->
<RadialGradientBrush GradientOrigin="0.3,0.3" Center="0.7,0.7" RadiusX="0.6" RadiusY="0.6">
<GradientStop Color="Red" Offset="0.0" />
<GradientStop Color="Green" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="Yellow" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path Stroke="Red" StrokeThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top">
<Path.Data>
<EllipseGeometry Center="140,70" RadiusX="120" RadiusY="60" />
</Path.Data>
</Path>
</Grid>
<Grid Margin="10">
<Rectangle Width="200" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top">
<Rectangle.Fill>
<!--
MappingMode - 指定线性渐变的起点(StartPoint)、终点(EndPoint)填充范围的 X 轴半径(RadiusX)和填充范围的 Y 轴半径(RadiusY)相对于输出区域是相对的还是绝对的 [System.Windows.Media.BrushMappingMode枚举]
MappingMode.RelativeToBoundingBox - 相对坐标。默认值
MappingMode.Absolute - 绝对坐标
-->
<RadialGradientBrush MappingMode="Absolute" GradientOrigin="60,30" Center="140,70" RadiusX="120" RadiusY="60">
<GradientStop Color="Red" Offset="0.0" />
<GradientStop Color="Green" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="Yellow" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path Stroke="Red" StrokeThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top">
<Path.Data>
<EllipseGeometry Center="140,70" RadiusX="120" RadiusY="60" />
</Path.Data>
</Path>
</Grid>
</StackPanel>
</UserControl>
OK
Tags:Silverlight 画笔 SolidColorBrush
编辑录入:爽爽 [复制链接] [打 印]- ››silverlight全屏显示图片
- ››Silverlight MVVM 模式(一) 切近实战
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››Silverlight for Symbian
- ››Silverlight3系列(四)数据绑定 Data Binding 1
- ››silverlight2 游戏 1 你能坚持多少秒
- ››Silverlight开发实践--PicZoomShow
- ››Silverlight自定义控件开发 - 令人懊恼的OnApplyT...
- ››Silverlight 2 RTW中ToolTipService.ToolTip不继承...
- 中查找“Silverlight(9) - 2.0画笔之SolidColorBrush, ImageBrush, VideoBrush, LinearGradientBrush, RadialGradientBrush”更多相关内容
- 中查找“Silverlight(9) - 2.0画笔之SolidColorBrush, ImageBrush, VideoBrush, LinearGradientBrush, RadialGradientBrush”更多相关内容
- 上一篇:Silverlight(10) - 2.0其它之Transform详解,以及UIElement和FrameworkElement的常用属性
- 下一篇:Silverlight(8) - 2.0图形之基类System.Windows.Shapes.Shape
更多精彩
赞助商链接