原文:
WPF入门(四)->线形区域Path内容填充之渐变色(LinearGradientBrush)
前面我们介绍到,Path对象表示一个用直线或者曲线连接的图形,我们可以使用Path.Data属性来设置该图形的形状,同时我们也可以使用Data.Fill属性来设置该图形中的填充色或背景图片等。
下面我们先来看一段代码
<
Window
x:Class
="WPF.SimpleGraph.PathFill.Window1"
xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
Title ="Window1" Height ="300" Width ="300" >
< Canvas >
< Path Stroke ="DarkGray" StrokeThickness ="2" >
< Path.Data >
< PathGeometry >
< PathFigure StartPoint ="40,40" IsClosed ="True" >
xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
Title ="Window1" Height ="300" Width ="300" >
< Canvas >
< Path Stroke ="DarkGray" StrokeThickness ="2" >
< Path.Data >
< PathGeometry >
< PathFigure StartPoint ="40,40" IsClosed ="True" >