在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
procedure TForm1.BitBtn1Click(Sender: TObject); var i,d,j:integer; editm:tedit; begin d:=0; j:=strtoint(num.text); for i:=1 to j do begin editm :=tedit.Create(self); with editm do begin editm.Parent:=ScrollBox1; editm.Width:=120; editm.Height:=20; editm.Left:=0; editm.Top:=0+d; editm.Name:='edit'+inttostr(i); editm.Text:='edit'+inttostr(i); editm.Visible:=true; d:=d+20; end; end;给动态创建的Edit控件动态添加OnChange事件:procedure TForm1.EditChange(Sender: TObject); begin showmessage(Tedit(Sender).text); end; procedure TForm1.EditChange(Sender: TObject); begin showmessage(Tedit(Sender).text); end; procedure TForm1.Button1Click(Sender: TObject); var NewEdit:Tedit; begin NewEdit:=Tedit.Create(nil); NewEdit.Parent:=self; NewEdit.SetBounds(10,20,50,21); NewEdit.OnChange:=EditChange; end; |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论