یک دکمه و یک ListBox روی فرمتون قرار بدین و به شکل زیر رویداد کلیک دکمه رو تغییر بدین درست میشه :
private void button1_Click(object sender, EventArgs e)
{
this.listBox1.Items.Clear();
FolderBrowserDialog dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
DirectoryInfo CurrentDirectoryInfo = new DirectoryInfo(dialog.SelectedPath);
foreach (FileInfo file in CurrentDirectoryInfo.GetFiles())
switch (file.Extension.ToUpperInvariant())
{
case ".BMP":
case ".JPG":
listBox1.Items.Add(file);
break;
}
}
}