Fork me on GitHub

RepeatButton

 

RepeatButton重点在Repeat,是一个重复的按钮,怎么个重复法呢?它是一个重复执行事件的按钮,如下面是一个单击按钮,如果一直按着按钮,它会一直执行事件(注:注意Int32的范围)

XAML代码:

<Grid x:Name="LayoutRoot">

<RepeatButton Width="100" DockPanel.Dock="Top" Delay="500" Interval="100"     Click="Increase" Margin="262,39,262,0" VerticalAlignment="Top" Height="129" Content="Increase"/>

<Button Name="btn" Width="100" DockPanel.Dock="Top" FontSize="16" d:LayoutOverrides="Width" HorizontalAlignment="Left" Margin="98,-1.657,0,1.657" Content="0"/>

</Grid>

CS代码:

Void   Increase(object sender, RoutedEventArgs e)

        {

            Int32 Num = Convert.ToInt32(btn.Content);

            btn.Content = ((Num + 1).ToString());

        }

posted @ 2007-04-23 22:15  桂素伟  阅读(2768)  评论(2编辑  收藏  举报