//如果有一个button的话
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog1 = new FolderBrowserDialog();
string imgtype = "*.BMP|*.JPG|*.GIF|*.PNG";
if (dialog1.ShowDialog() == DialogResult.OK)
{
string[] ImageType = imgtype.Split('|');
for (int i = 0; i < ImageType.Length; i++)
{
string[] tmp1 = System.IO.Directory.GetFiles(dialog1.SelectedPath, ImageType[i]);
foreach (string s in tmp1)
{
if (s.Length > 0)
{
this.imageList1.Images.Add(new System.Drawing.Bitmap(s));
}
}
}
}
}