我有一个列表框,我想用所有逻辑驱动器更新我的列表框。我想以父和子格式显示所有图像。我正在使用此代码 string [] path = System.IO.Directory.GetLogicalDrives();
foreach (string directories in path)
{
Bitmap bitimg = null;
DirectoryInfo dinfo = new DirectoryInfo(directories);
FileInfo[] Files = dinfo.GetFiles("*.jpg");
for (int i = 0; i < Files.Count(); i++)
{
string fileName = Files[i].FullName;
Uri uri = new Uri(fileName, UriKind.Relative);
BitmapImage bitmap=new BitmapImage(uri);
Image img = new Image();
img.Source(bitmap);
listBox1.Items.Add(img);
}
}
但我的错误是
Cannot create an instance of the abstract class or interface 'System.Drawing.Image'