csteinhilber
Programmer
I have a TImage in a D6 project that I assign an icon to via a handle I retrieve via a FileInfo object.
The TImage displays the icon fine.
I would then like to be able to save the icon as a BMP or GIF... and it just isn't working.
test.bmp is created... but never contains a well-formed bmp.
I've tried:
same result.
In the help for TPicture.Icon, I did read:
If Icon is referenced when the TPicture contains a Bitmap or Metafile graphic, the graphic won't be converted. Instead, the original contents of the TPicture are discarded and Icon returns a new, blank icon.
I'm sure that has something to do with it... but I can't figure out how to work around it.
Any insight would be appreciated.
-Carl
The TImage displays the icon fine.
I would then like to be able to save the icon as a BMP or GIF... and it just isn't working.
Code:
var
hIconHandle: HIcon;
:
begin
:
if hIconHandle <> 0 then
Image1.Picture.Icon.Handle := hIconHandle;
:
Image1.Picture.SaveToFile('c:\test.bmp');
:
end;
I've tried:
Code:
Image1.Picture.Bitmap.SaveToFile('c:\test.bmp');
Image1.Picture.Graphic.SaveToFile('c:\test.bmp');
In the help for TPicture.Icon, I did read:
If Icon is referenced when the TPicture contains a Bitmap or Metafile graphic, the graphic won't be converted. Instead, the original contents of the TPicture are discarded and Icon returns a new, blank icon.
I'm sure that has something to do with it... but I can't figure out how to work around it.
Any insight would be appreciated.
-Carl