日期:2014-05-17 浏览次数:20760 次
public partial class DownList : UserControl
{
private string[] info = null;
private string FileSize; // 下载文件总大小
private string FileTempSize; // 已下载文件大小
private int FileSpeed; // 实时下载速度
private int FileTemp; // 临时下载缓冲
private Form1 frm;
public static int rNum = -1;
public DownList(string[] Temp, Form1 form)
{
info = Temp;
frm = form;
rNum++;
}
public void DownList_Load()
{
frm.dataGridView1["status", rNum].Value = frm.imageList1.Images[2]; //显示下载状态图片
frm.dataGridView1["name", rNum].Value = Path.GetFileName(info[0]);
Thread Th = new Thread(new ParameterizedThreadStart(DownFile)); //创建下载线程
Th.IsBackground = true; //设置为后台线程,当主窗体关闭时,同时关闭线程
Th.Start(info); //启动线程
}
private void DownFile(object url)
{
string[] urlt = (string[])url; //转换类型
string[] str = new string[3]; &nbs