DELPHI动态创建删除FRAME---示例源码

上传者: qqrzl | 上传时间: 2023-12-12 19:35:07 | 文件大小: 311KB | 文件类型: RAR
DELPHI动态创建删除FRAME unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,FM; type TForm2 = class(TForm) Panel1: TPanel; Button2: TButton; ScrollBox1: TScrollBox; procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; type TFM = Array Of TFrame1; var Form2: TForm2; aFM: TFM; procedure DeleteArrItem(var arr: TFM ; Index: Integer);stdcall; implementation {$R *.dfm} procedure DeleteArrItem(var arr: TFM ; Index: Integer); var Count: Cardinal; i:integer; begin Count := Length(arr); if (Count = 0) or (Index < 0) or (Index >= Count) then Exit; Move(arr[Index+1], arr[Index], (Count-Index)* SizeOf(arr[0])); SetLength(arr, Count - 1); for I := 0 to Length(arr) - 1 do begin arr[i].Label1.Caption:=inttostr(i); end; end; procedure TForm2.Button2Click(Sender: TObject); var fram:TFrame1; begin SetLength(aFM,length(aFM)+1); aFM[length(aFM)-1] :=TFrame1.Create(nil) ; fram:=aFM[length(aFM)-1]; fram.Label1.Caption:=inttostr(length(aFM)-1); fram.Parent:=ScrollBox1; end; end. unit fm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TFrame1 = class(TFrame) GroupBox1: TGroupBox; Label1: TLabel; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation uses unit2; {$R *.dfm} procedure TFrame1.Button1Click(Sender: TObject); begin DeleteArrItem(aFM,strtoint(label1.Caption)); ( Sender as Tbutton ).Parent.Parent.Destroy; end; end.

文件下载

资源详情

[{"title":"( 12 个子文件 311KB ) DELPHI动态创建删除FRAME---示例源码","children":[{"title":"fm.pas <span style='color:#111;'> 585B </span>","children":null,"spread":false},{"title":"Project1.exe <span style='color:#111;'> 842.00KB </span>","children":null,"spread":false},{"title":"Project1.res <span style='color:#111;'> 5.16KB </span>","children":null,"spread":false},{"title":"fm.dcu <span style='color:#111;'> 4.39KB </span>","children":null,"spread":false},{"title":"Unit2.dfm <span style='color:#111;'> 983B </span>","children":null,"spread":false},{"title":"Unit2.dcu <span style='color:#111;'> 5.62KB </span>","children":null,"spread":false},{"title":"Project1.identcache <span style='color:#111;'> 196B </span>","children":null,"spread":false},{"title":"Unit2.pas <span style='color:#111;'> 1.22KB </span>","children":null,"spread":false},{"title":"Project1.dpr <span style='color:#111;'> 266B </span>","children":null,"spread":false},{"title":"fm.dfm <span style='color:#111;'> 699B </span>","children":null,"spread":false},{"title":"Project1.dproj.local <span style='color:#111;'> 1.16KB </span>","children":null,"spread":false},{"title":"Project1.dproj <span style='color:#111;'> 4.29KB </span>","children":null,"spread":false}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明