问题描述, 本地button 动态创建 Panel 并指定parent 为 form1,可以显示,程序并不死掉
代码太多,贴出相关代码
声明
type
TForm1 = class(TForm)
........
private
{ Private declarations }
public
{Public declarations }
MytpA : array[1..5] of TPanel; //序列
MytpAindex:integer; //当前序列号,随时变化的不存在问题
end;Button 事件
procedure TForm1.b........begin
MytpA[MytpAindex]:=TPanel.Create(self);
MytpA[MytpAindex].Height:=100;
MytpA[MytpAindex].Width:=100;
MytpA[MytpAindex].Left:=CurrentX+; //鼠标坐标X值
MytpA[MytpAindex].Top:=CurrentY; //鼠标坐标Y值
MytpA[MytpAindex].Parent:=Form1;
end;------------以上本地执行并无问题,程序有一TcpServer控件在其
procedure TForm1.TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient);
中同样创建 MytpA[MytpAindex]:=TPanel.Create(self);
MytpA[MytpAindex].Height:=100;
MytpA[MytpAindex].Width:=100;
MytpA[MytpAindex].Left:=CurrentX+; //鼠标坐标X值
MytpA[MytpAindex].Top:=CurrentY; //鼠标坐标Y值 //MytpA[MytpAindex].Parent:=Form1; 不加这句 程序 并不死掉 如果加了 程序死掉期待高手,高分相送 谢谢
代码太多,贴出相关代码
声明
type
TForm1 = class(TForm)
........
private
{ Private declarations }
public
{Public declarations }
MytpA : array[1..5] of TPanel; //序列
MytpAindex:integer; //当前序列号,随时变化的不存在问题
end;Button 事件
procedure TForm1.b........begin
MytpA[MytpAindex]:=TPanel.Create(self);
MytpA[MytpAindex].Height:=100;
MytpA[MytpAindex].Width:=100;
MytpA[MytpAindex].Left:=CurrentX+; //鼠标坐标X值
MytpA[MytpAindex].Top:=CurrentY; //鼠标坐标Y值
MytpA[MytpAindex].Parent:=Form1;
end;------------以上本地执行并无问题,程序有一TcpServer控件在其
procedure TForm1.TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient);
中同样创建 MytpA[MytpAindex]:=TPanel.Create(self);
MytpA[MytpAindex].Height:=100;
MytpA[MytpAindex].Width:=100;
MytpA[MytpAindex].Left:=CurrentX+; //鼠标坐标X值
MytpA[MytpAindex].Top:=CurrentY; //鼠标坐标Y值 //MytpA[MytpAindex].Parent:=Form1; 不加这句 程序 并不死掉 如果加了 程序死掉期待高手,高分相送 谢谢
TcpServer控件其
procedure TForm1.TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient); 中 调用相同的方法创建 就会出问题,现象是 Panel 创建了,但是 窗口不能拖动 然后程序死掉。经过调试 发现
MytpA[MytpAindex].Parent:=Form1; 是这句引起,如果去掉 的话程序运行正常 但是却无法显示动态的控件了