• Advertisement
Sign in to follow this  

Code not running and image not loading

This topic is 2014 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I posted my problem over at stackoverflow, but haven't found the solution yet.


private void LoadImageList()
{
string filepath = Application.StartupPath + @"\Content\Textures\Tiles\PlatformTiles.png";
Bitmap tileSheet = new Bitmap(filepath);
int tilecount = 0;
for (int y = 0; y < tileSheet.Height / TileGrid.TileHeight; y++)
{
for (int x = 0; x < tileSheet.Width / TileGrid.TileWidth; x++)
{
Bitmap newBitmap = tileSheet.Clone(
new System.Drawing.Rectangle(
x * TileGrid.TileWidth,
y * TileGrid.TileHeight,
TileGrid.TileWidth,
TileGrid.TileHeight),
System.Drawing.Imaging.PixelFormat.DontCare);
imgListTiles.Images.Add(newBitmap);
string itemName = "";
if (tilecount == 0)
{
itemName = "Empty";
}
if (tilecount == 1)
{
itemName = "White";
}
listTiles.Items.Add(new ListViewItem(itemName, tilecount++));
}
}
}


All I did was update PlatformTiles.png with a newer one and the next time I ran the program it doesn't load. I placed a breakpoint at int tilecount = 0; and it doesn't ever reach it. Everything after it doesn't run either. Any ideas? I used the original PlaformTiles.png and it doesn't work either.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

i think the problem is the same stated there. You shouldn't use file extensions with Content Loading in XNA.

I hope this helps.

weeska

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement