procedure TImageForm.FileListBox1Change(Sender: TObject);
var
FileExt:string[4];
Caption:string;{(此处定义)}
begin
FileExt:=ExtractFileExt(FileListBox1.FileName);
if(FileExt='.bmp') or (FileExt='.ico') then
begin
Image1.picture.loadFromFile(FileListBox1.FileName);
Caption:=FormCaption+ExtractFileName(FileListBox1.FileName);{(此处提示有错误)这里FormCaption会不会是Form.Caption?另外,这段代码是在窗体代码中的吧,Caption会不会与Form.Caption有冲突?而且TForm自己本身有Caption这个property,还用你定义吗?}
if(FileExt='.bmp')then
begin
Caption:=Caption+Format('%d*%d),
{这里,字符串符''没有结束,缺右边的,却多了一个右括号}
[Image1.Picture.Width,Image1.Picture.Height);
{^^^^前面的[多余}
ViewForm.Image1.Picture:=Image1.Picture;
ViewForm.Caption:=Caption;
end
if(FileExt='.ico')then Icon:=Image1.Picture.Icon;
end
else if(FileExt='.jpg) then
begin
JpgImage.LoadFromFile(FileListBox1.FileName);
Image1.Picture.Graphic:=JpgImage;
Caption:=FormCaption+ExtractFileName(FileListBox1.FileName);
Caption:=Caption+ Format(%d*%d),[Image1.Picture.Width,Image1.Picture.Height);
{ ^^^^^^^^^^^^^^^^^^^^^^^^上面!同样的错误}
ViewForm.Image1.Picture.Graphic:=JpgImage;
ViewForm.Image1.Caption:=Caption;
end
end
var
FileExt:string[4];
Caption:string;{(此处定义)}
begin
FileExt:=ExtractFileExt(FileListBox1.FileName);
if(FileExt='.bmp') or (FileExt='.ico') then
begin
Image1.picture.loadFromFile(FileListBox1.FileName);
Caption:=FormCaption+ExtractFileName(FileListBox1.FileName);{(此处提示有错误)这里FormCaption会不会是Form.Caption?另外,这段代码是在窗体代码中的吧,Caption会不会与Form.Caption有冲突?而且TForm自己本身有Caption这个property,还用你定义吗?}
if(FileExt='.bmp')then
begin
Caption:=Caption+Format('%d*%d),
{这里,字符串符''没有结束,缺右边的,却多了一个右括号}
[Image1.Picture.Width,Image1.Picture.Height);
{^^^^前面的[多余}
ViewForm.Image1.Picture:=Image1.Picture;
ViewForm.Caption:=Caption;
end
if(FileExt='.ico')then Icon:=Image1.Picture.Icon;
end
else if(FileExt='.jpg) then
begin
JpgImage.LoadFromFile(FileListBox1.FileName);
Image1.Picture.Graphic:=JpgImage;
Caption:=FormCaption+ExtractFileName(FileListBox1.FileName);
Caption:=Caption+ Format(%d*%d),[Image1.Picture.Width,Image1.Picture.Height);
{ ^^^^^^^^^^^^^^^^^^^^^^^^上面!同样的错误}
ViewForm.Image1.Picture.Graphic:=JpgImage;
ViewForm.Image1.Caption:=Caption;
end
end
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货