Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
TPicture and non-standard image file name extensions
1 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Question:
Can we use TPicture.LoadFromFile() for loading images while their file
extension isn't recognized by TPicture? For example if BMP files have been renamed to *.img.
Answer:
If you know the format and it is indeed a bitmap then you can force it to work - see the first piece of code below.
You can even register your own extension with the second piece of code.
 | |  | | begin
Image1.Picture.Bitmap.LoadFromFile('APicture.img');
Image1.Picture.RegisterFileFormat('img','Bitmap file',TBitmap);
Image1.Picture.LoadFromFile('APicture.img');
end. | |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
|