我想要在一个panel上面中动态生成另外一个pane控件实例,但是运行发生错误:stack overflow,请问要怎么动态生成才不能出错???换句话说,应该怎么写语句??
解决方案 »
- 在用edit或maskedit时,输入数据后回车,如何消出回车键盘按下出现的提示声音?
- 如何将注册表里用二进制表示的图片信息还原出来
- 怎样把FORM上的东西居中呢?
- 请高手执教,我想用directx实时播放从网络上传来的一个mpeg视频,应该怎么做呀?播放的是一个mpeg文件,但为了提高可靠性,每次读这个文
- 继承datamodule该复写那些方法
- 如何改變操作系統的日期格式???
- 怎样才能提高效率,往数据库中插入3000条记录,用的是adoquery,有别的办法吗?
- dbgridex的字符表格内容怎么老是自动变成T啊?
- 如何得到指定窗口中的各个控件的HWND????????
- 调用应用服务器上的方法。
- 直接取出字符串中的数字,有没有这样的函数?
- 关于应用程序相互调用的问题
MyPanel: TPanel;
begin
MyPanel := TPanel.Create(Self);
with MyPanel do
begin
Parent := YourPanel;
Left := 0;
Top := 5;
Height := 10;
Width := 10;
//可以设置其他的属性
end;
end;
var pan:Tpanel;
begin
pan:=Tpanel.Create(self);
pan.Parent:=panel1;
end;
MyPanel: TPanel;
begin
MyPanel := TPanel.Create(Self);
with MyPanel do
begin
Parent := Panel1; //这里修改一下
Left := 0;
Top := 5;
Height := 10;
Width := 10;
//可以设置其他的属性
end;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;type
TForm1 = class(TForm)
Panel1: TPanel;
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
i:integer;
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}//动态创建如下:
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);var
panelx:Tpanel;
begin
panelx:=Tpanel.Create(self);
panelx.Parent:=Panel1;
panelx.Width :=100;
panelx.Height :=50;
panelx.Left :=x;
panelx.Top :=y;
panelx.Name :=inttostr(i);
i:=i+1;end;end.
with myPanel do
begin
属性设置;
事件调用;
end;
begin
Mypanel:=TPanel.Create(self);
with MyPanel do
begin
parent:=Panel1;
width:=10;
height:=10;
top:=5;
left:=5
end;