Extracting Images from Icons

Given a Test.ico file with two images — a 16x16 and a 32x32 — here's how to programmatically extract either image from the ICO file.

To extract the 16x16 image
string iconFile = "Test.ico";
Icon ico = new Icon(iconFile, 16, 16);
this.pictureBox1.Image = ico.ToBitmap();

To extract the 32x32 image
string iconFile = "Test.ico";
Icon ico = new Icon(iconFile, 32, 32);
this.pictureBox1.Image = ico.ToBitmap();