So I created a program that load 100 pictures onto the screen, each picture basically represents an object, and let the user pick which one they want.
The problem is the app isnt able to load 100 images without leaving a ton of red x's in my pictureboxes.
How can I reduce the amount of memory each picture requires?
EDIT: The images are not actually plain black, I just have not played with the Image scale yet to show what I want. The image sizes are actually 4288 x 2848. I dont need that on this screen, a small scale image will work.
This is for an auction display. So essentially the image you see here is a thumbnail, and will take you to the page of the auction item.
CODE: Using infragistics/WPF
foreach (var item in Vehicles)
{
BitmapImage b = new BitmapImage();
b.BeginInit();
b.UriSource = new Uri(item.OverviewImage);
b.EndInit();
var addTile = new XamTile
{
Content = new Image { Source = b}
};
tileManager.Items.Add(addTile);
}
Other code I tried, not using infragistics/C#
public List<Vehicle> Vehicles { get; set; }
private int count = 0;
public AuctionScreen()
{
InitializeComponent();
Vehicles = new List<Vehicle>();
}
private void AuctionScreen_Load(object sender, EventArgs e)
{
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
var m = new PictureBox();
m.ImageLocation = Vehicles[count].OverviewImage;
flowLayoutPanel1.Controls.Add(m);
if (count > Vehicles.Count)
{
timer1.Stop();
}
}