我希望能点击一个按钮,在一个Panel上能创建DBGrid控件,
点击另一个按钮,在同样的Panel上创建别的控件。
不知道该怎么写,谢谢指点!!!
点击另一个按钮,在同样的Panel上创建别的控件。
不知道该怎么写,谢谢指点!!!
解决方案 »
- 储过程的运行速度,在什么语言前台内运行最快
- 如何获取其他进程中MSFlexGrid的内容-该MSFlexGrid的句柄已经取得
- javascript有一个encodeURI函数, 用Delphi如何实现?
- 客户端退出了,服务端也自动退出,但服务端所在机子的windows中的右下角还留有图标,why?
- 请问哪里可以下载到delphi6.0,谢谢!
- 如何用SQL语句创建一个有小数字段的表,小数格式为两位小数,默认值为零(ACCESS数据库)?
- 关于电子白板的录制
- 在Delphi 6 中使用Ado的数据库系统,发布时应带哪些库文件,谢谢!!
- 女孩子可以做程序员吗?
- 提问!
- 怎样取消断点?取消所有断点呢?
- ADOQuery.SQL的问题
DBGrid.Parent:=Panel;
var
DBGrid1:TDBGrid;
begin
DBGrid1 := TDBGrid.create(panel1);
DBGrid1.parent := panel1;
//然后设置其显示各项属性,
end;
列设置:
DBGrid1.Columns.Add;
DBGrid1.Columns.Items[0].FieldName := 'Sdrq';
DBGrid1.Columns.Items[0].Title.Caption := '收订日期';
DBGrid1.Columns.Items[0].Width := 110;
DBGrid1.Columns.Items[0].Alignment := taRightJustify;
DBGrid1.Columns.Items[0].Title.Alignment := taCenter;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids;type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses
DBGrids;
{$R *.dfm}
var
DBGrid:TDBGrid ;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not assigned(DBGrid) then
begin
DBGrid:=TDBGrid.Create(Self);
DBGrid.Parent:=Panel1;
end;
end;end.
DBGrid.Parent:=Panel1;
精华吖,不要分,随便跟一下的
MYgrid : TDBGrid;
begin
Mygrid := TDBGrid.Create(Self);
with MyGrid do
begin
Parent:= Form1;
Top := Form1.Top + 100 ;
Left := Form1.Left + 20 ;
Width := 100;
Height := 20;
end;
end;
//创建其他控件也是一样的原理,只要改变类名就可以了
//parent属性是表示创建的控件放在什么容器上面
var
DBGrid1:TDBGrid;
begin
DBGrid1 := TDBGrid.create(self);
DBGrid1.parent := panel1;
//然后设置其显示各项属性,
end;
DBGrid.Parent:=Panel1;