如何在silverlight c#中剪辑星形路径的网格

本文关键字:路径 网格 silverlight | 更新日期: 2023-09-27 18:10:48

我有一个Grid &StarPath

 <Path x:Name="StarPath" Data="M213,135 L183,213 L87,246 L159,288 C159,288 140,372 140,375 C140,378 226,329 226,329 L303,367 L280,275 L316,216 L246,219" Fill="#FF0EB679" HorizontalAlignment="Left" Height="241.132" Margin="86.5,134.5,0,0" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" VerticalAlignment="Top" Width="230"/>
 <Grid HorizontalAlignment="Left" Height="300"  Width="300" Background="#FFD11010"/> <br/><br/>

我正试图得到我的Grid in the shape of Star shaped Path
谁能给我提供Clipping Grid by Path by Code的提示或样本?

如何在silverlight c#中剪辑星形路径的网格

您可以尝试采用这种方法…

MyGrid.Clip = getPathGeometry(StarPath.Data.ToString());

您必须在测试中添加"||",并更改数据。替换为data = data.Replace("M", " M").Replace("C", " C").Replace("L", " L");