Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

image

$
0
0

This is how i have been shown how to get images and was wondering if anyone new any other ways of puting images in 

Random rnd;


string currDir = Environment.CurrentDirectory;
DirectoryInfo di = Directory.GetParent(currDir);
di = Directory.GetParent(di.FullName);
string imgDir = di.FullName + "\\Images\\";
var imagesFiles = Directory.EnumerateFiles(imgDir);

rnd = new Random();
Img1 = rnd.Next(imagesFiles.Count());
img1.Source = new BitmapImage(new Uri(imagesFiles.ElementAt(Img1)));


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>