如何在 xaml C# Windows 8 中显示对象周围的选取框样式边框 [英] How to show Marquee style border around object in xaml C# Windows 8

查看:23
本文介绍了如何在 xaml C# Windows 8 中显示对象周围的选取框样式边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is there a way to show marquee style border around objects in WinRT?

我看到边框有描边样式,

I see there is stroke style of border,

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

but I want it to move around the object like the lasso tool border in Photoshop or Paint.

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

Also I need to decide what should be the color of the gap between two strokes of the dashes.

谢谢.

推荐答案

这就是你想要的,因为你想要填充颜色:

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>

看起来像这样:

祝你好运!

这篇关于如何在 xaml C# Windows 8 中显示对象周围的选取框样式边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆