datetime和timer的使用(小小幻灯片)
一:展示图片
每秒换一次图片,一共六十张图片,00-59
二:代码
a,设计代码
- namespace timePicture
- {
- partial class Form1
- {
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.IContainer components = null;
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- #region Windows 窗体设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要
- /// 使用代码编辑器修改此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.timer1 = new System.Windows.Forms.Timer(this.components);
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.SuspendLayout();
- //
- // pictureBox1
- //
- this.pictureBox1.Location = new System.Drawing.Point(, );
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(, );
- this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
- this.pictureBox1.TabIndex = ;
- this.pictureBox1.TabStop = false;
- //
- // timer1
- //
- this.timer1.Enabled = true;
- this.timer1.Interval = ;
- this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(, );
- this.Controls.Add(this.pictureBox1);
- this.Name = "Form1";
- this.Text = "Form1";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- private System.Windows.Forms.PictureBox pictureBox1;
- private System.Windows.Forms.Timer timer1;
- }
- }
b,逻辑代码
- 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 timePicture
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- /// <summary>
- /// 事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void timer1_Tick(object sender, EventArgs e)
- {
- //y 表示年 M 月 d 日 HH 24小时制 m 分 s 秒
- //this.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- string path=this.Text =Application.StartupPath+"\\image\\" +DateTime.Now.ToString("ss")+".jpg";
- this.pictureBox1.Image = Image.FromFile(path);
- }
- }
- }
datetime和timer的使用(小小幻灯片)的更多相关文章
- C# System.Threading.Timer 使用方法
public class TimerHelper { System.Threading.Timer timer; public TaskSendMMS tasksendmms { get; set; ...
- .NET中的三种Timer的区别和用法
最近正好做一个WEB中定期执行的程序,而.NET中有3个不同的定时器.所以正好研究研究.这3个定时器分别是: //1.实现按用户定义的时间间隔引发事件的计时器.此计时器最宜用于 Windows 窗体应 ...
- .NET中的三种Timer的区别和用法(转)
最近正好做一个WEB中定期执行的程序,而.NET中有3个不同的定时器.所以正好研究研究.这3个定时器分别是: //1.实现按用户定义的时间间隔引发事件的计时器.此计时器最宜用于 Windows 窗 ...
- 转:.NET中的三种Timer的区别和用法(转)
//1.实现按用户定义的时间间隔引发事件的计时器.此计时器最宜用于 Windows 窗体应用程序中,并且必须在窗口中使用. System.Windows.Forms.Timer // 2.提供以指定的 ...
- 【转】.NET中的三种Timer的区别和用法
最近正好做一个WEB中定期执行的程序,而.NET中有3个不同的定时器.所以正好研究研究.这3个定时器分别是: //1.实现按用户定义的时间间隔引发事件的计时器.此计时器最宜用于 Windows 窗体应 ...
- Forms.Timer、Timers.Timer、Threading.Timer的研究
.NET Framework里面提供了三种Timer System.Windows.Forms.Timer System.Timers.Timer System.Threading.Timer 一.S ...
- [Python] iupdatable包:Timer 类使用介绍
iudatable包是我对常用函数进行的封装后发布的一个python包,教程汇总目录: [Python] iupdatable包使用说明 安装 iupdatable 包 pip install iup ...
- jQuery简单倒计时插件
一. 效果预览 二. 实现 1. 按照特定的类结构布局. 2. 需要先引入jQuery,再引入此文件. /** * Author: CC11001100 * * 简单倒计时 * * 1. 支持页面内同 ...
- c# 中定时器的用法
来源于:http://blog.sina.com.cn/s/blog_62c501440100fog1.html System.Threading.Timer 是一个非常常用的定时器类,关于这个类的使 ...
随机推荐
- onContextItemSelected 用法
http://blog.csdn.net/kavensu/article/details/8045041 onCreateOptionsMenu :此方法为创建菜单方法,这个菜单就是你在点击手机men ...
- java异常类的使用
1.异常的概念 什么是异常?程序出错分为两部分,编译时出粗和运行时出错.编译时出错是编译器在编译源码时发生的错误: 运行时出错是在编译通过,在运行时出现的错误.这种情况叫异常. 例如:数组越界,除数为 ...
- angularjs kindEditor 中content获得不到值
angularjs kindEditor 中content获得不到值 需要修改下angular-kindeditor.js angular-kindeditor.js if (KindEditor) ...
- Linux软件
网上下载:Chrome Browser for Linux; sqlite; WPS; symbol-fonts; 软件中心:Terminator; Code::Blocks IDE; 新立得软件 ...
- Linq 调试
void Main() { var MyMonitor = new Devart.Data.Oracle.OracleMonitor(); MyMonitor.IsActive = true; var ...
- xceed wpf datagrid
<!--*********************************************************************************** Extended ...
- Linux 删除文件夹
inux删除目录很简单,很多人还是习惯用rmdir 1.直接rm就可以了:rm -rf 目录名字 -r 就是向下递归,不管有多少级目录,一并删除-f 就是直接强行删除,不作任何提示的意思
- 如何制作css3的3d动画——以骰子旋转为例,详解css3动画属性
首先先来看两个用css3实现的炫酷的3d动画效果 1 2 3 4 5 6 你没看错,这个炫酷的效果都是用css3实现的. 下面是动画实现所需要用到的几个css3属性. 1.perspective: ...
- Servlet(三)
重定向 服务器向浏览器发送一个302状态码以及一个Location消息头(该消息头的值是一个地址,称之为重定向地址),浏览器收到后会立即向重定向的地址发出请求,使用相应对象的API方法实现(respo ...
- POJ 1734.Sightseeing trip (Floyd 最小环)
Floyd 最小环模板题 code /* floyd最小环,记录路径,时间复杂度O(n^3) 不能处理负环 */ #include <iostream> #include <cstr ...