[英]How can I load images from the hard disk and display them in pictureBox with timer?
private void timer1_Tick(object sender, EventArgs e)
{
foreach (string image in filesRadar)
{
pictureBox1.Load(image);
}
}
private void timer2_Tick(object sender, EventArgs e)
{
foreach (string image in filesSatellite)
{
pictureBox2.Load(image);
}
}
I'm not getting any errors/exceptions and using breakpoint it stop on the Load line/s but it's not showing the images on any of the pictureBoxes.我没有收到任何错误/异常,并使用断点在 Load line/s 上停止,但它没有在任何图片框上显示图像。
This is working.这是有效的。 could be in other ways but it's working.
可能有其他方式,但它正在起作用。
int radImagesCount = 0;
private void timer1_Tick(object sender, EventArgs e)
{
radImagesCount++;
if (radImagesCount == filesRadar.Length)
{
radImagesCount = 0;
}
pictureBox1.Image = new Bitmap(filesRadar[radImagesCount]);
}
int satImagesCount = 0;
private void timer2_Tick(object sender, EventArgs e)
{
satImagesCount++;
if (satImagesCount == filesSatellite.Length)
{
satImagesCount = 0;
}
pictureBox2.Image = new Bitmap(filesSatellite[satImagesCount]);
}
Both filesRadar and filesSatellite are string[] arrays contains the images fils. filesRadar 和 filesSatellite 都是包含图像文件的 string[] 数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.