【问题标题】:How to fill an ellipse with different colors in Windows Phone 8.1 XAML?如何在 Windows Phone 8.1 XAML 中用不同颜色填充椭圆?
【发布时间】:2016-10-26 15:23:10
【问题描述】:

我正在使用 xaml 和 C# 开发一个 WP8.1 应用程序。 我想要一个按钮或椭圆填充多种颜色,如下图所示。除了使用饼图控件外,我如何实现这一点? 我只需要它的最大高度为 80,宽度为 80 有人可以帮我吗? 提前感谢

【问题讨论】:

    标签: xaml windows-runtime windows-phone-8.1 winrt-xaml


    【解决方案1】:

    您使用弧形控件来创建此形状。

    xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing"
    
               <Grid>
                     <es:Arc ArcThickness="1" ArcThicknessUnit="Percent" EndAngle="360" Fill="#FF82ECDD" HorizontalAlignment="Left" Height="293" Margin="0,0,0,-100" Stretch="None" StartAngle="61" UseLayoutRounding="False" VerticalAlignment="Top" Width="294"/>
                     <es:Arc ArcThickness="1" ArcThicknessUnit="Percent" EndAngle="360" Fill="#FF38B5E4" HorizontalAlignment="Left" Height="293" Margin="0,0,0,-100" Stretch="None" StartAngle="298" UseLayoutRounding="False" VerticalAlignment="Top" Width="294" RenderTransformOrigin="0.5,0.5">
                                        <es:Arc.RenderTransform>
                                            <CompositeTransform Rotation="61.609"/>
                     </es:Arc.RenderTransform>
                     </es:Arc>
                     <es:Arc ArcThickness="1" ArcThicknessUnit="Percent" EndAngle="360" Fill="#FF349AD4" HorizontalAlignment="Left" Height="293" Margin="0,0,0,-100" Stretch="None" StartAngle="179" UseLayoutRounding="False" VerticalAlignment="Top" Width="294" RenderTransformOrigin="0.5,0.5">
                     <es:Arc.RenderTransform>
                                            <CompositeTransform Rotation="-119.36"/>
                     </es:Arc.RenderTransform>
                     </es:Arc>
                 </Grid>
    

    【讨论】:

    • 感谢您的帮助.. 谢谢
    • 如果它解决了您的问题,请不要忘记将其标记为已回答,:)
    【解决方案2】:

    您可以将单个椭圆转换为路径,然后删除路径中的一个点使其成为半圆。 将三个半圆以适当的角度旋转,以实现类似于上图的效果。

    【讨论】:

    • 嘿 Chirag.. 我尝试了各种方法,但都没有成功。你能分享一个示例代码吗?
    • 你必须使用混合,右键单击椭圆转换为路径,然后单击四个点之一,然后按删除。你会得到半圆。
    猜你喜欢
    • 2011-03-17
    • 2015-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-02
    • 2016-07-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多