111,120
社区成员
发帖
与我相关
我的任务
分享int ico = 1;
private void timer1_Tick(object sender, EventArgs e)
{
string path; //把图标设置成数字名,获取图标保存路径
path = "d:\\" + ico.ToString() + ".ico";
//实例图标对象赋值给控件的Icon属性
this.notifyIcon1.Icon = new Icon(path);
ico++;//变换图标序号
if (ico > 2)
{
ico = 1; //还原图标序号
}
}
public partial class Form1 : Form
{
string[] temp = new string [3];//假如你存三张图片
int i = 0;
public Form1()
{
InitializeComponent();
temp[0] = @"F:\图片库\生活留恋\新华公园\P1020090.jpg";//这里要有扩展名
temp[1] = @"F:\图片库\生活留恋\新华公园\P1020091.jpg";
temp[2] = @"F:\图片库\生活留恋\新华公园\P1020092.jpg";
this.timer1.Start();//这里开始Timer,还有就是你的那个时间间隔设置稍微长点(2000),不然你看不懂图案的转变
}
private void timer1_Tick(object sender, EventArgs e)
{
if (i < 3)
{
this.pictureBox1.Image = Image.FromFile(temp[i]);
i++;
}
}
}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;
using System.IO;
using System.Collections;
using System.Data .SqlClient ;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
string[] temp = new string [3];//假如你存三张图片
int i = 0;
public Form1()
{
InitializeComponent();
temp[0] = "放图片1的路径";
temp[1] = "放图片2的路径";
temp[2] = "放图片3的路径";
}
private void timer1_Tick(object sender, EventArgs e)
{
if (i < 3)
{
this.pictureBox1.Image = Image.FromFile(temp[i]);
i++;
}