因为要根据数据库中查询的字段数目确定编辑框数目,因此需要用变量i去控制动态生成i个edit编辑框,请问有什么方法可以实现!?
解决方案 »
- 怎样才能缩短批量显示缩略图的时间
- 大家帮忙看看这是用什么控件的啊!下划线的Edit
- 请问一个D7启动的问题????
- ★★微软正则表达式组件TRegExp是线程不安全的吗?★★
- 200分高难度问题,解决立即给分(文件统计)
- 软件安装问题,会者不难
- 类型转换提示有内存错误,请教,马上给分
- 请推荐和TSuperGrid(只有Delphi2,3,4版)功能类似的,能在Delphi5下使用的,可以用CheckBox作为元素的Grid类控件
- 突然想到一个问题:如何删除当前.db库中G字段类型里的图像资料?
- 我在PUBLIC 中声明过了但在另一个单元也不能引用
- 打算从d7转d2006,请大家多提宝贵意见。
- ****高手请进:如何通过编程实现为XP系统下的一个文件夹添加用户,详情请进,问题解决立即给分****
procedure TFrmCodeSet.InitFormData(const aDataSource:TDataSource);
var i,C:integer;
begin C :=0; for i:=0 to aDataSource.DataSet.FieldCount-1 do
begin
if aDataSource.DataSet.Fields[i].Visible then
begin
With TLabel.Create(Self) do
Try
Parent :=Self.PnlData;
Caption :=aDataSource.DataSet.Fields[i].DisplayLabel+':';
Left :=18;
Top :=20+32*C;
AutoSize :=False;
Width :=80;
Except
free;
end; if aDataSource.DataSet.Fields[i].FieldKind=fkData then
With TDBEditEh.Create(Self) do
Try
Parent :=Self.PnlData;
DataSource :=aDataSource;
DataField :=aDataSource.DataSet.Fields[i].FieldName;
Flat :=True;
AlwaysShowBorder :=True;
Left :=120;
Top :=16+32*C;
Width :=320;
if ((C=0) and (aDataSource.State=dsEdit)) then
Enabled :=False;
Except
free;
end
else if aDataSource.DataSet.Fields[i].FieldKind=fkLookup then
With TDBLookupComboboxEh.Create(Self) do
Try
Parent :=Self.PnlData;
DataSource :=aDataSource;
DataField :=aDataSource.DataSet.Fields[i].FieldName;
Flat :=True;
AlwaysShowBorder :=True;
Left :=120;
Top :=16+32*C;
Width :=320;
if ((C=0) and (aDataSource.State=dsEdit)) then
Enabled :=False;
Except
free;
end
else
Continue; //其它类型暂不处理。
Inc(C);
end;
end;
Self.Height :=92+32*C;
end;