TImage似乎不支持D7(免费版)中的Jpeg? [英] TImage does not seem to support Jpeg in D7 (free edition)?
问题描述
procedure TmainForm.FormCreate(Sender: TObject);
var img : TImage;
pic:TPicture;
begin
pic := TPicture.create();
pic.LoadFromFile('my_picture.jpg');
img := Timage.create(Self);
img.Picture := pic;
end;
...
"Project MyProect.exe raised exception class EInvalidGraphic
with message 'Unknown picture extension (.jpg)'"
,当然,就在函数TPicturePropertyEditor.Execute()中,它仅处理.ICO和.BMP文件!
and, sure enough, right there in function TPicturePropertyEditor.Execute() it only handles .ICO and .BMP files!
奇怪的是,如果我在设计时& quot;单击其图片属性,然后文件加载对话框将显示.JPG文件(如果我加载一个,则会崩溃)- _NOTE _ 这是D7的免费供个人使用版本,已随计算机赠送mag多年前。
The weird thing is that if I place a TImage on a form at design time & click its Picture property then the file load dialog shows me .JPG files (and crashes if I load one) - _NOTE_ this is the "free for personal use" version of D7 that was given away with a computer mag many years ago.
该怎么办?编写我自己的VCL组件?也许有人已经发明了(FOSS)滚轮?
What to do? Code my own VCL component? Or maybe someone already invented that (FOSS) wheel?
推荐答案
创建一个新项目,然后编写(例如)
Create a new project, and write (for example)
procedure TForm1.FormCreate(Sender: TObject);
var
img: TPicture;
begin
img := TPicture.Create;
img.LoadFromFile('C:\Users\Andreas Rejbrand\...\tiles55.jpg');
end;
这将生成未知图片文件扩展名(.jpg)错误。但是,如果将
This will generate the "Unknown picture file extension (.jpg)" error. However, if you add "Jpeg" to the uses
clause, then it will work.
这篇关于TImage似乎不支持D7(免费版)中的Jpeg?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!