这里使用了一个进度条来展示,

前段代码:

 <Window x:Class="TimerTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="" Width="">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="241,249,0,0" VerticalAlignment="Top" Width="" Click="Button_Click"/>
<ProgressBar x:Name="pb" Minimum="" Maximum="" HorizontalAlignment="Left" Height="" Margin="10,151,0,0" VerticalAlignment="Top" Width=""/> </Grid>
</Window>

后台代码:

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading; namespace TimerTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
} private void Button_Click(object sender, RoutedEventArgs e)
{
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(, , );
dispatcherTimer.Start();
} private void dispatcherTimer_Tick(object sender, EventArgs e)
{
pb.Value += ;
}
}
}

最新文章

  1. bzoj2548[Cstc2002]灭鼠行动
  2. Activity 与 Service 之间的消息传递
  3. 咋一看DWoo 比 Smarty要好
  4. [SQL]SQL优化34条
  5. emWin使用外部SRAM的方法
  6. Android_Spinner_Listener
  7. map关联容器
  8. sctf pwn300
  9. MyEclipse 2015 Stable 2.0破解方法
  10. redis读书笔记
  11. 说一下Servlet里面得request和response
  12. 更改了react-redux 官方网站的todolist结构
  13. CentOS6.8 配置LVM
  14. fastcgi_next_upstream error timeout invalid_header http_500 http_503(转)
  15. BZOJ3419[POI2013]taxis——贪心
  16. 6609 - Minimal Subarray Length
  17. windows 环境下安装elasticsearch ,ik,head,marvel
  18. SSL学习笔记
  19. djngo 1.9版本以后 Foreignkey() 字段 第二个参数 on_delete 必不可少, mysql 外键可以为空
  20. 20155210潘滢昊 Java第二次试验

热门文章

  1. LUN
  2. CORS 跨域请求
  3. HTML 属性绑定
  4. .Net Mvc5Filter与权限认证扩展
  5. let、const和var的区别
  6. 【timeisprecious】【JavaScript 】JavaScript RegExp \W 元字符
  7. 【awk】按小时切割日志
  8. Centos搭建Groovy开发环境
  9. JSP入门之自定义标签
  10. Springboot接口简单实现生成MySQL插入语句