如何清除scrollbox中控件?

rubber365 2003-09-08 10:28:02
我在编写一个类似acdsee的图片浏览工具,我用的方法是在scrollbox中
动态的创建Timage控件并同时将图片载入。我现在困惑的是,打开另外一个
文件夹的时候原来的图片仍然在,无法清楚,这是什么原因呢?

。。。
for i:=0 to scrollbox1.ComponentCount-1 do
begin
scrollbox1.components[i].free;
end;


scrollbox1.Refresh;
scrollbox1.Realign;
scrollbox1.Repaint;

scrollbox1.VertScrollBar.Position:=0;

for i:=0 to FileCount do
begin
testcc:=timage.Create(self);
testcc.Picture.LoadFromFile('c:\Store_Small_photo\'+FileList[i]);
GetJpegSize('c:\Store_Small_photo\'+FileList[i],tempwidth,tempheight);
testcc.Left:=x;
testcc.Top:=y;
testcc.Parent:=scrollbox1;
testcc.Width:=tempwidth;
testcc.Height:=tempheight;
testcc.Visible:=true;
inc(x,122);
if x>264 then
begin x:=20; inc(y,120); end;
application.processmessages;
end;

。。。
...全文
64 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
hahafan 2003-09-08
  • 打赏
  • 举报
回复
testcc:=timage.Create(self);
改成
testcc:=timage.Create(scrollbox1);

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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