![](/img/trans.png)
[英]How can i get images from the hard disk resize the images and add them to a list<image> fast?
[英]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);
}
}
我沒有收到任何錯誤/異常,並使用斷點在 Load line/s 上停止,但它沒有在任何圖片框上顯示圖像。
這是有效的。 可能有其他方式,但它正在起作用。
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]);
}
filesRadar 和 filesSatellite 都是包含圖像文件的 string[] 數組。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.