4
C#:WPF故事板死亡
public partial class MainWindow : Window
{
Storyboard a = new Storyboard();
int i;
public MainWindow()
{
InitializeComponent();
a.Completed += new EventHandler(a_Completed);
a.Duration = TimeSpan.FromMilliseconds(10);
a.Begin();
}
void a_Completed(object sender, EventArgs e)
{
textblock.Text = (++i).ToString();
a.Begin();
}
}
XAML:
<Window x:Class="Gui.MainWindow" x:Name="control"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="300" Width="300">
<Canvas>
<TextBlock Name="textblock"></TextBlock>
</Canvas>
什麼是錯的代碼? 故事板在20-50回合後停止。每次有不同的號碼
非常有趣的問題,我發現這停止了,當我的鼠標移過TextBlock我有時得到1500。 – 2008-11-24 21:18:36