钟表计时器
来源:互联网 发布:java根据模板生成pdf 编辑:程序博客网 时间:2024/04/27 23:46
钟表计时器
实现代码:
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace _2{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } public void GetTime() { DateTime time = DateTime.Now; int year = time.Year; int month = time.Month; int day = time.Day; int hour = time.Hour; int h1 = 0; int h2 = hour; ; if (hour >= 10) { h1 = hour / 10; h2 = hour % 10; } int minute = time.Minute; int m1 = 0; int m2 = minute; if (minute >= 10) { m1 = minute / 10; m2 = minute % 10; } int second = time.Second; int s1 = 0; int s2 = second; if (second >= 10) { s1 = second / 10; s2 = second % 10; } label1.Text = string.Format("{0}{1}:{2}{3}:{4}{5}", h1, h2, m1, m2, s1, s2);//label控件显示时间 label2.Text = string.Format("{0}年{1}月{2}日",year ,month,day); } private void timer1_Tick(object sender, EventArgs e) { // label2.Text = DateTime.Now; this.GetTime(); } private void Form1_Load(object sender, EventArgs e) { this.timer1.Interval = 1000; this.timer1.Start(); } }}
阅读全文
0 0
- 钟表计时器
- js 计时器 (timer)和钟表
- JS实现钟表计时器功能
- 钟表
- 仿MIUI计时器+圆形SeekBar+钟表表盘UI 三位一体式自定义View
- flash 钟表 钟表代码
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- 计时器
- ThoughtWorks 2018校园招聘作业
- spring实现同一账号同一时间只能在同一个地方登录
- 回文串划分(动态规划)
- 2017年沈阳网赛
- IO流
- 钟表计时器
- hibernate的5种查询方式
- 关于C++中16进制的输入
- Java实现数组、List互相转换
- css复习——背景background day2
- 除了程序,我还有这些爱好
- 数组
- 极化码小结(1)
- SpringBoot使用FastJson解析Json数据