C#:
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 轮后停止。每次都是不同的号码