O
okgxsh
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;Type TAutoCreatePanel = class(TObject) private PNN : Tpanel; public constructor Create(cParent: TComponent); procedure FreePanel; end;type TForm1 = class(TForm) Button1: TButton; Panel1: TPanel; Button2: TButton; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; FAutoCreatePanel : array of TAutoCreatePanel ;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);beginend;{ TAutoCreatePanel }constructor TAutoCreatePanel.Create(cParent: TComponent);begin inherited Create; PNN := Tpanel.Create(nil); //报内容地址错误 PNN.Width := 10; PNN.Height:= 10;end;procedure TAutoCreatePanel.FreePanel;beginend;procedure TForm1.Button1Click(Sender: TObject);begin SetLength(FAutoCreatePanel , 10); //回馈串口监控数组 FAutoCreatePanel[1].create(Nil);//的时候出现错误end;procedure TForm1.Button2Click(Sender: TObject);var PNN : Tpanel;begin PNN := Tpanel.Create(nil); //按钮直接点击可以创建 PNN.Width := 10; PNN.Height:= 10;end;end.