1

有没有办法在 WinRT 中的对象周围显示选取框样式边框?

我看到有边框的描边样式,

但我希望它像 Photoshop 或 Paint 中的套索工具边框一样在对象周围移动。

此外,我需要决定两笔划线之间的间隙颜色应该是什么。

谢谢你。

4

2 回答 2

1

This is what you want, since you want the fill color:

<Page.Resources>
    <Storyboard RepeatBehavior="Forever" x:Name="Test">
        <DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" 
                Storyboard.TargetProperty="(Shape.StrokeDashOffset)" 
                Storyboard.TargetName="Marquee1">
            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="3.5"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" 
                Storyboard.TargetProperty="(Shape.StrokeDashOffset)" 
                Storyboard.TargetName="Marquee2">
            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="2.5"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Rectangle x:Name="Marquee1" Height="200" Width="200" 
               Stroke="Red" StrokeThickness="10" StrokeDashArray="0.5 2" 
               StrokeDashOffset="1" StrokeDashCap="Square" />
    <Rectangle x:Name="Marquee2" Height="200" Width="200" 
               Stroke="Green" StrokeThickness="10" StrokeDashArray="0.5 2" 
               StrokeDashOffset="0" StrokeDashCap="Square" />
    <Image Height="175" Width="175" />
</Grid>

Looks like this:

enter image description here

Best of luck!

于 2013-11-20T19:43:10.453 回答
0

找到了一种像在 Photoshop 中一样获得选取框样式边框的方法:

<Storyboard RepeatBehavior="Forever">
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageToDisplayBorder" Storyboard.TargetProperty="StrokeThickness">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="2"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageToDisplayBorder" Storyboard.TargetProperty="Stroke">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PaperDark}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageToDisplayBorder" Storyboard.TargetProperty="StrokeDashArray">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="3, 3"/>
                        <DiscreteObjectKeyFrame KeyTime="00:00:0.200" Value="3, 3"/>
                        <DiscreteObjectKeyFrame KeyTime="00:00:0.400" Value="3, 3"/>
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageToDisplayBorder" Storyboard.TargetProperty="StrokeDashOffset">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="3"/>
                        <DiscreteObjectKeyFrame KeyTime="00:00:0.200" Value="0"/>
                        <DiscreteObjectKeyFrame KeyTime="00:00:0.400" Value="3"/>
                    </ObjectAnimationUsingKeyFrames>

                </Storyboard>

我仍然没有办法指定 Gap 颜色

于 2013-11-05T23:10:42.600 回答