图像加载问题 [英] Image loading problem

查看:127
本文介绍了图像加载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个程序,显示我的图像及其数据(日期,相机型号,ISO,......)。如果有GPS标签,它还会显示'是地图,照片拍摄地点。



问题:



图片显示'所有数据加载后都已启动,包括地图。



但我想尽快得到图片可能,数据可以显示出来了。

我试图用backgroundWorker解决问题,但它没有用。



以下是加载图片的代码:

 pictureBox1.ImageLocation = photosPath +   \\ + listView1.Items [CurPic-  1 ]。文字; 
this .Refresh(); // 我还尝试刷新表格,图片框,......
pictureBox1。刷新();
Application.DoEvents();
lblName.Text = listView1.Items [CurPic - 1 ]。文字; // 当前图片的名称
lblGPS.Text = /; // 如果没有GPS标签 - 写/
loadData.RunWorkerAsync() ;





后台工作人员调用两种方法:



  private   void  loadData_DoWork(object sender,DoWorkEventArgs e)
{
show_info(pictureBox1.ImageLocation); // 加载数据
showlocation(getlocation(pictureBox1.ImageLocation)); // 获取位置并显示地图
}





此代码有效,与没有后台工作者相同。有没有其他方法可以解决这个问题。请帮忙。

解决方案

试试这个(警告:会阻止用户界面!):

 pictureBox1.WaitOnLoad = ; 
pictureBox1.Load( ...);

/拉维


I wrote a program, that shows my images and their data (date, camera model, ISO, ...). If there is a GPS tag it also show''s the map, where the picture was taken.

The problem:

The picture show''s up after all data has been loaded, including the map.

But I want to get the picture as soon as possible and the data can show''s up later.
I tried to solve the problem with backgroundWorker, but it doesn'' work.

Here is the code for loading the picture:

pictureBox1.ImageLocation = photosPath + "\\" + listView1.Items[CurPic-1].Text;
this.Refresh();        //I also tried to refresh the form, picture box, ...
pictureBox1.Refresh();
Application.DoEvents();
lblName.Text = listView1.Items[CurPic - 1].Text; //the name of the current pic
lblGPS.Text = "/";          //In case, there is no GPS tag - write /
loadData.RunWorkerAsync();



The background worker calls two methods:

private void loadData_DoWork(object sender, DoWorkEventArgs e)
        {
            show_info(pictureBox1.ImageLocation);   //loading data
            showlocation(getlocation(pictureBox1.ImageLocation));   //getting location and showing map
        }



This code works, just the same as without background worker. Is there any other way to solve this. Please help.

解决方案

Try this (warning: will block the UI!):

pictureBox1.WaitOnLoad = true;
pictureBox1.Load ("...");

/ravi


这篇关于图像加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆