简体   繁体   English

如何用 SVG 替换 Canvas 元素?

[英]How can I replace Canvas element with SVG?

I'm currently trying to give a canvas element a shape that has a round border.我目前正在尝试为画布元素提供具有圆形边框的形状。 As I know from my experience, the CornerRadius parameter/method does not exist in the Canvas class?根据我的经验, Canvas类中不存在CornerRadius参数/方法?

I want to use an SVG element instead of this white canvas element.我想使用 SVG 元素而不是这个白色画布元素。

<Canvas Background="White" Width="250" Height="200">
    <TextBlock Text="LOW" Foreground="Black" FontSize="30" TextAlignment="Center" Margin="10"></TextBlock>
    <TextBlock FontSize="40" Padding="0, 0, 300, 0" Margin="74" Text="11" Foreground="Black"></TextBlock>
</Canvas>

这个画布元素到 SVG

Problem Solved问题解决了

<Border CornerRadius="10" Background="White" Height="200" Width="200">
                <Canvas Background="White"  Width="250" Height="200" HorizontalAlignment="Left" >
                    <TextBlock Text="LOW" Foreground="Black" FontSize="30" TextAlignment="Center" Margin="10"></TextBlock>
                    <TextBlock FontSize="40" Padding="0, 0, 300, 0" Margin="74" Text="11" Foreground="Black">
                    </TextBlock>
                </Canvas>
</Border>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM