如何让 Animate 控件相应 Mouse Click 事件(50分)

  • 主题发起人 主题发起人 Yong
  • 开始时间 开始时间
Y

Yong

Unregistered / Unconfirmed
GUEST, unregistred user!
如何让 Animate 控件相应 Mouse Click 事件
 
这样处理一下:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls;

type
TMyAnimate=class(TAnimate)
private
procedure CNCommand(var Message: TWMCommand); message CN_COMMAND;
public
procedure Click; override;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure test(sender:tobject);
public
{ Public declarations }
end;
var
Form1: TForm1;
a:TMyAnimate;
implementation

{$R *.DFM}
procedure TMyAnimate.CNCommand(var Message: TWMCommand);
begin
if Message.NotifyCode = BN_CLICKED then Click;
end;
procedure TMyAnimate.Click;
begin
inherited Click;
showmessage('Animate click demo!');
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if a<>nil then a.free;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
a:=TMyanimate.Create(self);
a.Left:=100;
a.Top:=100;
a.Width:=200;
a.Height:=200;
a.Color:=clblack;
a.Parent:=self;
a.Visible:=true;
end;

end.
 
接受答案了.
 
后退
顶部