C# 轮流展示照片
2024-10-06 01:50:53
代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Threading; namespace picture_0
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} Thread th;
private void Form1_Load(object sender, EventArgs e)
{
th = new Thread
(
delegate ()
{ for (int i = ; i < ; i++)
{ ChangeImage(Image.FromFile(@"picture\18720223738_6b6c58f282_o.jpg"), );
ChangeImage(Image.FromFile(@"picture\amargosa-river-stars.jpg"), ); }
}
);
th.IsBackground = true;
th.Start(); } private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
th.Abort();//结束线程
} private void ChangeImage(Image img, int millisecondsTimeOut)
{
this.Invoke(new Action(() =>
{
pictureBox1.Image = img;
})
);
Thread.Sleep(millisecondsTimeOut); } }
}
代码
最新文章
- Python之路3【第一篇】Python基础
- liunx常用的命令
- NetFPGA
- Hadoop中JAVA不经过Catch(Exception e)直接到finally或者退出原因
- 使用javascript实现在页面打印的效果的三种方式
- HIS与CIS的区别与联系
- Web开发中的主要概念
- SQL SERVER 与ACCESS、EXCEL的数据转换
- ARC机制下组合关系
- MySQL 日志管理详解
- rfid门禁系统笔记
- art template前端模板引擎
- [转载]10 Best Tools For Websites And Apps Development Ever
- PHP 中的超全局变量
- XMPP得知--建立一个管理类
- for计算100以内的偶数和
- 使用Spring MVC构建REST风格WEB应用
- C++11 学习 间隔更新中
- QScintilla 编译
- Java中Jdom解析XML