帮帮我拉~~~

涟漪之湖 2008-04-06 03:38:42
procedure TForm1.Button1Click(Sender: TObject);
var
I:Integer;
Myrect:Trect;
Myimg:array[0..100] of Tbitmap;
const
pw=100;
ph=200;
begin
for I := 0 to FileListBox1.Items.Count - 1 do
begin
with myrect do
begin
left:=200+(pw+100)*(I mod 6+1);
top:=200+400*(I div 7);
right:=left+pw;
bottom:=top+ph;
end;
Printer.BeginDoc;
begin
Filelistbox1.ItemIndex:=I;
Myimg[I].LoadFromFile(filelistbox1.FileName);
Myimg[I]:=tbitmap.Create;
Printer.Canvas.StretchDraw(myrect,Myimg[I]);
end;
end;
end;

end.
...全文
66 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
涟漪之湖 2008-05-05
  • 打赏
  • 举报
回复
最致命的错误在于我忘了enddoc....
别的瞎瞎也不会出错..
涟漪之湖 2008-05-05
  • 打赏
  • 举报
回复
不好意思好没来
问题其实已经自己解决了
分享一下吧
procedure TForm1.Button1Click(Sender: TObject);
var
I:Integer;
Myrect:Trect;
Myimg:TJpegimage;
textleft:Integer;
texttop:Integer;
textstr:string;
begin
Printer.BeginDoc;
printer.canvas.font.name:='黑体';
printer.canvas.font.size:=10;
Myimg:=TJpegimage.Create;
for I := 0 to FileListBox1.Items.Count - 1 do
begin
with myrect do
begin
left:=Strtoint(edit3.text)+
(Strtoint(edit1.text)+
Strtoint(edit5.text))*(I mod Strtoint(edit7.text));
top:=Strtoint(edit4.text)+
Strtoint(edit6.text)*(I div Strtoint(edit7.text));
right:=left+Strtoint(edit1.text);
bottom:=top+Strtoint(edit2.text);
end;
Filelistbox1.ItemIndex:=I;
Myimg.LoadFromFile(filelistbox1.FileName);
Printer.Canvas.StretchDraw(myrect,Myimg);
textleft:=Strtoint(edit3.text)+(Strtoint(edit1.text)+
Strtoint(edit5.text))*(I mod Strtoint(edit7.text));
texttop:=Strtoint(edit4.text)+
Strtoint(edit6.text)*(I div Strtoint(edit7.text))+
Strtoint(edit2.text)+Strtoint(edit8.text);
textstr:=
changefileext(extractfilename(DirectoryListBox1.Directory),'')+
changefileext(extractfilename(filelistbox1.filename),'');
printer.canvas.textout(textleft,texttop,textstr);
end;
Printer.EndDoc;
end;
meiZiNick 2008-05-01
  • 打赏
  • 举报
回复
好像没那么简单,呵呵.
UltraBejing 2008-04-30
  • 打赏
  • 举报
回复
什么呀
hsmserver 2008-04-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 unsigned 的回复:]
Myimg[I].LoadFromFile(filelistbox1.FileName);
Myimg[I]:=tbitmap.Create;
=============
这两行的位置写反了。
[/Quote]
pengxuan 2008-04-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 unsigned 的回复:]
Myimg[I].LoadFromFile(filelistbox1.FileName);
Myimg[I]:=tbitmap.Create;
=============
这两行的位置写反了。
[/Quote]

是写反了,对象应该先创建,再使用
僵哥 2008-04-06
  • 打赏
  • 举报
回复
Myimg[I].LoadFromFile(filelistbox1.FileName);
Myimg[I]:=tbitmap.Create;
=============
这两行的位置写反了。
dl110 2008-04-06
  • 打赏
  • 举报
回复
出什么问题了?
try__again 2008-04-06
  • 打赏
  • 举报
回复
最好把出现的问题也描述一下,可以有针对性的看看

5,388

社区成员

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

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