T
troyliu
Unregistered / Unconfirmed
GUEST, unregistred user!
我的类是一个动态建立的,但是当我点击image时(也就是关闭这个对象)为什么出错。(大部分时间没有)
大概是10次到20次出现一次;请教高手。
错误信息如下:
---------------------------
Debugger Exception Notification
---------------------------
Project tt.exe raised exception class EAbstractError with message 'Abstract Error'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TMyPanel = class(TPanel)
FMined: TImage;
FClose: TImage;
Private
procedure MinedClick(Sender: TObject);
public
constructor Create(AOwner: Tcomponent);override;
destructor Destroy;override;
end;
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
MyPanel: TMyPanel;
implementation
{$R *.dfm}
constructor TMyPanel.Create(AOwner: Tcomponent);
begin
inherited Create(AOwner);
FMined := TImage.Create(self);
FMined.Parent := self;
FMined.Left := 10;
Fmined.Top := 10;
FMined.Height := 10;
FMined.Width := 10;
Fmined.AutoSize := True;
FMined.Picture := TForm1(Owner).Image1.Picture;
FMined.OnClick := MinedClick;
end;
destructor TMyPanel.Destroy;
begin
inherited Destroy;
end;
procedure TMyPanel.MinedClick(Sender: TObject);
begin
Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyPanel := TMyPanel.Create(self);
MyPanel.Parent := Form1;
MyPanel.Top := 21;
MyPanel.Left := 21;
MyPanel.Height := 50;
MyPanel.Width := 90;
end;
大概是10次到20次出现一次;请教高手。
错误信息如下:
---------------------------
Debugger Exception Notification
---------------------------
Project tt.exe raised exception class EAbstractError with message 'Abstract Error'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TMyPanel = class(TPanel)
FMined: TImage;
FClose: TImage;
Private
procedure MinedClick(Sender: TObject);
public
constructor Create(AOwner: Tcomponent);override;
destructor Destroy;override;
end;
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
MyPanel: TMyPanel;
implementation
{$R *.dfm}
constructor TMyPanel.Create(AOwner: Tcomponent);
begin
inherited Create(AOwner);
FMined := TImage.Create(self);
FMined.Parent := self;
FMined.Left := 10;
Fmined.Top := 10;
FMined.Height := 10;
FMined.Width := 10;
Fmined.AutoSize := True;
FMined.Picture := TForm1(Owner).Image1.Picture;
FMined.OnClick := MinedClick;
end;
destructor TMyPanel.Destroy;
begin
inherited Destroy;
end;
procedure TMyPanel.MinedClick(Sender: TObject);
begin
Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyPanel := TMyPanel.Create(self);
MyPanel.Parent := Form1;
MyPanel.Top := 21;
MyPanel.Left := 21;
MyPanel.Height := 50;
MyPanel.Width := 90;
end;