鱼C论坛

 找回密码
 立即注册
查看: 3149|回复: 2

delphi求助

[复制链接]
发表于 2012-7-8 19:40:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
一个小程序,让图片不断弹出,但弹出一定程度资源耗尽,程序就死啦,怎么能让图片边创建边关闭原来的图片
程序地址http://115.com/file/e7xc1dkj#pandora进行曲.zip
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-7-25 16:59:22 | 显示全部楼层
  1. var
  2.   Forms: array[0..100] of TForm1;
  3.   CurIndex: Integer;


  4. {$R *.dfm}

  5. procedure TForm2.tmr1Timer(Sender: TObject);
  6. begin
  7.    if Assigned(Forms[CurIndex]) then
  8.    begin
  9.      Forms[CurIndex].Close;
  10.      Forms[CurIndex].Free;
  11.      Forms[CurIndex] := nil;
  12.    end;

  13.    Forms[CurIndex] := TForm1.Create(Self);
  14.    Forms[CurIndex].Show;
  15.    Inc(CurIndex);
  16.    if CurIndex > 100 then CurIndex := 0;


  17. end;
复制代码
此外Unit1中的FormCreate事件中,要改一下:
Self.Left:=x;
Self.top:=y;

经测试,101个窗体下,耗费了200多M的内存。。。:D 不过歌曲蛮好听的。
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2014-10-20 13:14:49 | 显示全部楼层
看看
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-15 07:22

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表