日期:2014-05-20 浏览次数:20729 次
public partial class PicListEx : UserControl
{
private Size size = new Size(100, 100);
private Thread LoadPictureThread = null;
public PicListEx()
{
InitializeComponent();
lViewPic.View = View.LargeIcon;
}
/// <summary>
/// 加载图片
/// </summary>
/// <param name="filePaths">包含图片路径的数组</param>
public void loadPicFile(List<string> filePaths)
{
if (LoadPictureThread == null || !LoadPictureThread.IsAlive)
{
LoadPictureThread = new Thread(new ParameterizedThreadStart(LoadPictureFunc));
LoadPictureThread.IsBackground = true;
LoadPictureThread.Start(filePaths);
}
else
{
return;
}
}
private void LoadPictureFunc(object obj)
{
List<string> filePaths = null;
if (obj is List<string>)
{
filePaths = obj as List<string>;
}
else
{
return;
}
try
{
Invoke(new MethodInvoker(new Action(delegate()
{