Sign in to follow this  
raidzero

Code not running and image not loading

Recommended Posts

I posted my problem over at [url="http://stackoverflow.com/questions/11857819/why-isnt-my-image-loading"]stackoverflow[/url], but haven't found the solution yet.

[CODE]
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++));
}
}
}
[/CODE]

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
Hi,

i think the problem is the same stated [url="http://www.mobilemancer.com/2011/01/28/xna-error-loading-content-file-not-found/"]there[/url]. 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this