编程为何出错?各位大虾帮忙啊!

ledalln 2001-08-22 11:53:07
这是我编的一段:老是提示caption一句unterminated string错误,后来我定义了,可是提示还是unterminated string,为何?
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);(此处提示有错误)
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
...全文
37 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
kuangning 2001-08-22
  • 打赏
  • 举报
回复
将caption 改为my_caption 试一下
sunhuiNO1 2001-08-22
  • 打赏
  • 举报
回复
caption是个全局变量,你改个名字再试!
little_f 2001-08-22
  • 打赏
  • 举报
回复
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

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧