Displaying icons in a PictureBox

Jan 12 2005 2:14 AM
I have a picture box which is 48x48 in size and I want to set the image at runtime using a System.Drawing.Icon object which I have previously loaded. This object has a range of images, including the 48x48 size. I wish to know how I can display the icon in the picture box so the quality and resolution is the same as if I selected an icon file in design time and assigned this to the PictureBox. At present I am cloning the icon to a new object and specifying the desired size using: Icon newIcon = new Icon( originalIcon, 48, 48 ); I then have to convert the new icon object to a bitmap (newIcon.ToBitmap()) and use this to populate the PictureBox. However this results is a grainy/poor quality image appearing in the picture box - at least not as good as when selecting an icon file in the designer. If I set the image property of the PictureBox at design time by selecting an icon file (*.ico) the image displayed is very crisp and clean and is at the highest resolution the icon supports. I guess that I need to do some sort of image conversion from the icon object to some sort of high resolution image object. The .ToBitmap() method in the Icon object is obviously not sufficient. Can anyone help please?