110,545
社区成员
发帖
与我相关
我的任务
分享
rivate void button4_Click(object sender, EventArgs e) //form1中的button4控件
{
Form f2 = new Form();
f2.Text = "学籍照片批量下载";
TextBox firstNumberText = new System.Windows.Forms.TextBox();
TextBox lastNumberText = new System.Windows.Forms.TextBox();
Button downloadButton = new System.Windows.Forms.Button();
downloadButton.Text = "批量下载";
f2.Controls.Add(firstNumberText);
f2.Controls.Add(lastNumberText);
f2.Controls.Add(downloadButton);
f2.Show();
downloadButton.Click += new System.EventHandler(downloadButton_Click);
this.Visible = false;
this.Enabled = false;
f2.Visible = true;
f2.Enabled = true;
}
private void downloadButton_Click(object sender, EventArgs e)
{
WebClient myclient = new WebClient();
for (int i = int.Parse(firstNumberText.Text); i < int.Parse(lastNumberText.text); i++)
{
myclient.DownloadFile("http://www.abc.com/" + Convert.ToString(i) + "/.jpg", i + @".jpg");
}
}