See
Bitmap.GetHicon Method[
^].
1. Save your icon image in the DB as a .jpg image.
2. Retrieve your icon image into a Bitmap variable, say bitmap.
Bitmap bitmap;
3. Convert the Bitmap into an Icon handle.
IntPtr icon_handle = bitmap.GetHicon ( );
4. Create new Icon from the Icon handle.
Icon icon = Icon.FromHandle ( icon_handle );
5. Set Form Icon to the new icon.
this.Icon = icon;
6. Destroy the icon, since the form creates its own copy of the icon.
[ System.Runtime.InteropServices.DllImport ( "user32.dll",
CharSet = CharSet.Auto ) ]
extern static bool DestroyIcon(IntPtr handle);
DestroyIcon ( icon.Handle );