Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在xaml中创建按形状剪裁的文本_C#_.net_Xaml_Shapes_Textblock - Fatal编程技术网

C# 在xaml中创建按形状剪裁的文本

C# 在xaml中创建按形状剪裁的文本,c#,.net,xaml,shapes,textblock,C#,.net,Xaml,Shapes,Textblock,有什么想法吗?我如何使用xaml通过shape编辑lip文本 也许我可以用大厚度的圆形边框和背景颜色重叠文本,但如果背景不是纯色呢 以下是我想要的示例: 我选择的方法是使用uiElement.Clip属性。它允许您仅使用矩形进行剪辑,因此需要多次剪辑 我组合了三个旋转0度、30度和60度的剪切正方形,并使用了一个薄的重叠圆边框来隐藏十二边形的角。下面是代码,以防有人需要它: <Ellipse x:Name="Ellipse" Fill="#FF8813B4" He

有什么想法吗?我如何使用xaml通过shape编辑lip文本

也许我可以用大厚度的圆形边框和背景颜色重叠文本,但如果背景不是纯色呢

以下是我想要的示例:


我选择的方法是使用uiElement.Clip属性。它允许您仅使用矩形进行剪辑,因此需要多次剪辑

我组合了三个旋转0度、30度和60度的剪切正方形,并使用了一个薄的重叠圆边框来隐藏十二边形的角。下面是代码,以防有人需要它:

            <Ellipse x:Name="Ellipse" Fill="#FF8813B4"  Height="85" Margin="0" Width="85" StrokeThickness="0"
                 HorizontalAlignment="Center" VerticalAlignment="Center" />
        <Grid Width="84" Height="84" HorizontalAlignment="Center">
            <Grid>
                <Grid>
                    <TextBlock x:Name="Label" Text="Tample"  FontSize="70" HorizontalAlignment="Left" VerticalAlignment="Center"
                       FontFamily="Open Sans Semibold" Margin="0,2,0,0" Foreground="#7FFFFFFF" FontWeight="Bold"/>
                    <Grid.Clip>
                        <RectangleGeometry Rect="0,0,84,84">
                            <RectangleGeometry.Transform>
                                <CompositeTransform Rotation="60" CenterX="42" CenterY="42"/>
                            </RectangleGeometry.Transform>
                        </RectangleGeometry>
                    </Grid.Clip>
                </Grid>                
                <Grid.Clip>
                        <RectangleGeometry Rect="0,0,84,84">
                            <RectangleGeometry.Transform>
                                <CompositeTransform Rotation="30" CenterX="42" CenterY="42"/>
                            </RectangleGeometry.Transform>
                        </RectangleGeometry>
                    </Grid.Clip>
                </Grid>
                <Grid.Clip>
                    <RectangleGeometry Rect="0,0,84,84">
                        <RectangleGeometry.Transform>
                            <CompositeTransform Rotation="0" CenterX="42" CenterY="42"/>
                        </RectangleGeometry.Transform>
                    </RectangleGeometry>
                </Grid.Clip>
            </Grid>
        <Ellipse Stroke="#FF8813B4" StrokeThickness="2" Width="87" Height="87" HorizontalAlignment="Center" VerticalAlignment="Center"></Ellipse>