winform幻灯片效果

huangyuancao 2008-12-12 11:56:51
知道一个大概的方法
把图片路径放进一个数组
再用另一个数组保存显示顺序
最后用个timer和 picturebox来显示效果

不过以前没弄过
想寻求段各位以前弄过的代码

在这里先谢谢了
...全文
455 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zgke 2008-12-12
  • 打赏
  • 举报
回复
private void timer1_Tick(object sender, EventArgs e)
{
if (_Index > _ImageList.Count-1) _Index = 0;
pictureBox1.Image = _ImageList[_Index];
_Index++;
}

private IList<Image> _ImageList = new List<Image>();
private int _Index = 0;
private void button5_Click(object sender, EventArgs e)
{
_ImageList.Add(Image.FromFile(@"c:\1.BMP"));
_ImageList.Add(Image.FromFile(@"c:\b.BMP"));

timer1.Interval = 1000;
timer1.Enabled = true;

}
huangyuancao 2008-12-12
  • 打赏
  • 举报
回复
万分感谢
happychou 2008-12-12
  • 打赏
  • 举报
回复
学习了....
wjl0303 2008-12-12
  • 打赏
  • 举报
回复
Dictionary<int, string> paths = new Dictionary<int, string>();
int j = 0;
private void button3_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string[] str = openFileDialog1.FileNames;
for (int i = 0; i < str.Length; i++)
{
paths.Add(i, str[i]);
}
}
timer1.Enabled = true;
timer1.Interval = 2000;
}

private void timer1_Tick(object sender, EventArgs e)
{
if (paths.ContainsKey(j))
{
pictureBox1.Image = Image.FromFile(paths[j]);
}
j++;
}

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧