使用Timer组件实现倒计时
实现效果:

知识运用:
Timer组件的Enabed属性
实现代码:
private void timer1_Tick(object sender, EventArgs e)
{
DateTime get_time = DateTime.Now;
DateTime str_time = DateTime.Parse(dateTimePicker1.Text.Substring(0,19));
textBox1.Text = get_time.ToString();
txtyear.Text = DateAndTime.DateDiff(
"yyyy",get_time,str_time,FirstDayOfWeek.Sunday,FirstWeekOfYear.FirstFourDays).ToString();
txtmonth.Text = DateAndTime.DateDiff(
"m", get_time, str_time, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays).ToString();
txtday.Text = DateAndTime.DateDiff(
"d", get_time, str_time, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays).ToString();
txthour.Text = DateAndTime.DateDiff(
"h", get_time, str_time, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays).ToString();
txtmintue.Text = DateAndTime.DateDiff(
"m", get_time, str_time, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays).ToString();
txtsecon.Text = DateAndTime.DateDiff(
"s", get_time, str_time, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays).ToString();
}
使用Timer组件实现倒计时的更多相关文章
- Timer组件
1.常用属性 Interval 用于获取或设置Timer组件Tick事件发生的时间间隔,属性值不能小于1 制作左右飘摇窗体 private void timer1_Tick(object sender ...
- 使用Timer组件_实现定时更改窗体颜色
1 向窗体拖入Timer组件 2 更改其Enable属性为true 3 其interval属性为300 4 在Tick事件中写入随机变色代码 private void timer1_Tick(obje ...
- 使用Timer组件制作计时器
实现效果: 知识运用: Timer组件的interval属性 //获取或设置Timer组件Tick事件发生的时间间隔 public int Interval {get;set} NumericUpDo ...
- VUE组件 之 倒计时(防刷新)
思路: 一.效果图: 二.CSS代码 .box{ width: 300px; height: 100px; line-height: 100px; margin: 100px auto; backgr ...
- 使用Timer组件实现人物动画效果
实现效果: 知识运用: Graphics类的DrawImage方法 //在指定位置 按原始大小绘制指定的Image对象 public void DrawImage(Image image,Point ...
- 使用Timer组件制作左右飘动的窗体
实现效果: 知识运用: Form类的Left和Top属性 实现代码: private void timer1_Tick(object sender, EventArgs e) { Rectangle ...
- Delphi Timer组件
- Android简易实战教程--第四十八话《Android - Timer、TimerTask和Handler实现倒计时》
之前本专栏文章中的小案例有写到:第三十九话<Chronometer实现倒计时> 以及使用异步实现倒计时:第三十三话< AsyncTask异步倒计时> 本篇文章 结合Timer. ...
- ARMV8 datasheet学习笔记4:AArch64系统级体系结构之Generic timer
1.前言 2.generate timer 2.1 概述 提供了一个系统计数器,用来实时测量流逝的时间: 提供了一个虚拟计数器,用来测量某个虚拟机上流逝的虚拟时间: 定时器,每隔一段时间会触发事件,支 ...
随机推荐
- POJ - 1458 Common Subsequence DP最长公共子序列(LCS)
Common Subsequence A subsequence of a given sequence is the given sequence with some elements (possi ...
- python 学习笔记8 (模块)
Python 模块(Module),是一个 Python 文件,以 .py 结尾,包含了 Python 对象定义和Python语句. 模块让你能够有逻辑地组织你的 Python 代码段. 把相关的代码 ...
- 【Java】NIO中Channel的注册源码分析
Channel的注册是在SelectableChannel中定义的: public abstract SelectionKey register(Selector sel, int ops, Obje ...
- Linux运用一些常用命令
今天搜集整理了一些Linux服务器运维常用命令,希望对大家有帮助:1.删除0字节文件 find -type f -size 0 -exec rm -rf {} 2.查看进程按内存从大到小排列 ps - ...
- 51nod1287(二分/线段树区间最值&单点更新)
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1287 题意:中文题诶- 解法1:b[i] 存储 max(a[0 ...
- JS高级学习历程-15
昨天内容回顾 面向对象的私有成员.静态成员 私有成员:在构造函数里边定义局部变量,就是私有成员. 静态成员:在js里边,函数就是对象,可以通过给函数对象声明成员方式声明静态成员. 原型继承 关键字:p ...
- iOS 隐藏百度地图SDK的百度LOGO
第一个思路:找到LOGO对应的UIIMageView,并将其隐藏hidden // 隐藏百度地图Logo UIView *mView = _mapView.subviews.firstObject; ...
- 关于Django查询知识点总结
========关于Django查询知识点总结======= models.Book.objects.filter(**kwargs): querySet [obj1,obj2] models.Boo ...
- CodeForces - 581B-Luxurious Houses
The capital of Berland has n multifloor buildings. The architect who built up the capital was very c ...
- CSS3 - CheakBox 开关效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...