我想再重载BUTTON的MOUSE事件,怎么不行了呢.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMyEvent = procedure (Sender: TObject; S: string) of object;
Tmyeventdown = Procedure (Sender:Tobject;S :String) of Object;
TMyButton = class(TButton)
private
FOnMyClick: TMyEvent;
FonMousedown:Tmyeventdown;
public
procedure Click; override; //重载TButton.Click;
procedure Mousedown; override; //重载TButton.mousedown;
published
property OnMyClick: TMyEvent read FOnMyClick write FOnMyClick;
Property Onmousedown: Tmyeventdown read Fonmousedown Write Fonmousedown;
end;
另,有没有办法不用继承实现这种方法,直接将动态创建的BUTTON的MOUSEDOWN事件或者CLICK事件指向到一个过程或者事件(不是窗体上已有的事件,而是自已定义的事件)呢.上面的方法太麻烦了.