我在 WPF 中创建一个表单,当用户输入错误的值时,标签文本应该从红色闪烁到黑色再到红色等。你将如何在标签中创建这种类型的效果。
问问题
2630 次
1 回答
1
For i as Integer = 0 to 3
YourLabel.Visibility = Visibility.Hidden
'use Thread.Sleep() or Timer etc. to pause it for some time
YourLabel.Visibility = Visibility.Visible
'use Thread.Sleep() or Timer etc. to pause it for some time
Next
或者,您可以使用情节提要动画来实现相同的效果:
<Storyboard x:Key="BlinkAnimation">
<DoubleAnimation Storyboard.TargetName="YourLabel"
Storyboard.TargetProperty="Opacity"
From="0" To="1" RepeatBehavior="5x"
AutoReverse="True" Duration="0:0:0.5"/>
</Storyboard>
于 2013-10-29T07:49:26.340 回答