那些edit里的数据哪来的? 数据库?<br><br>type<br> TEditList=array of TObject;<br><br>...<br><br> private<br> { Private declarations }<br> edtlists:array of TEditList;<br> procedure clearedtlists;<br><br>...<br><br>procedure TForm1.clearedtlists;<br>var<br> i:integer;<br>begin<br> for i:=0 to length(edtlists)-1 do<br> begin<br> TLabel(edtlists[0]).Free;<br> TEdit(edtlists[1]).Free;<br> TEdit(edtlists[2]).Free;<br> TEdit(edtlists[3]).Free;<br> setlength(edtlists,0);<br> end;<br> setlength(edtlists,0);<br>end;<br><br>procedure TForm1.ComboBox1Select(Sender: TObject);<br>var<br> i,x,<br> t,l:integer; {这两个控制显示位置,自己改}<br>begin<br> clearedtlists;<br> x:=combobox1.ItemIndex+1; {获得显示的行数,我默认combobox里行数和数字是对应的}<br> setlength(edtlists,x);<br> t:=10;<br> for i:=0 to x-1 do<br> begin<br> l:=10;<br> setlength(edtlists,4);<br> edtlists[0]:=TLabel.Create(self);<br> with TLabel(edtlists[0]) do<br> begin<br> Parent:=self;<br> Caption:='Label'+inttostr(i);<br> SetBounds(l,t,100,13);<br> end;<br> inc(l,100+10); {控件间隔10像素}<br> edtlists[1]:=TEdit.Create(self);<br> with TEdit(edtlists[1]) do<br> begin<br> Parent:=self;<br> Text:=inttostr(i)+',0'; {省事按edit处理了,自己修改成读数据库数据}<br> SetBounds(l,t,100,21);<br> end;<br> inc(l,100+10); {控件间隔10像素}<br> edtlists[2]:=TEdit.Create(self);<br> with TEdit(edtlists[2]) do<br> begin<br> Parent:=self;<br> Text:=inttostr(i)+',1'; {省事按edit处理了,自己修改成读数据库数据}<br> SetBounds(l,t,100,21);<br> end;<br> inc(l,100+10); {控件间隔10像素}<br> edtlists[3]:=TEdit.Create(self);<br> with TEdit(edtlists[3]) do<br> begin<br> Parent:=self;<br> Text:=inttostr(i)+',2'; {省事按edit处理了,自己修改成读数据库数据}<br> SetBounds(l,t,100,21);<br> end;<br> inc(t,30); {行间隔30像素}<br> end;<br>end;