The code works fine for me.
public partial class Form1 : Form<br /> {<br /> public Form1()<br /> {<br /> InitializeComponent();<br /><br /> Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);<br /> Image myThumbnail = this.imageList1.Images[0].GetThumbnailImage(this.pictureBox1.Size.Width - 5, this.pictureBox1.Size.Height - 5, myCallback, IntPtr.Zero);<br /> this.pictureBox1.Image = myThumbnail;<br /> this.pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;<br /> }<br /><br /> private bool ThumbnailCallback()<br /> {<br /> return true;<br /> }<br /> }
And the app exits fine.
Failure to exit is usually caused by a thread not terminating correctly. Does your abort callback get triggered? Does it correctly return?
You don't need to release the Image. This is handled by the Imagelist for you provided that you have added your image list via the designer or correctly disposed of it manually, either way though, this wouldn't prevent your app from closing.
After you have closed your app, and it's stuck without terminating, try hitting the pause button and looking at the call stack to see where it is stuck.