C
cailihui
Unregistered / Unconfirmed
GUEST, unregistred user!
在[red]Delphi7[/red]中,請注意是Delphi7,新建一組件,定義一過程鼠標進入消息,然后新建一項目,在設計時使用該組件,這時竟然也觸發了鼠標事件!同樣的代碼在Delphi6.0中是正常的!
unit prSpeedButton;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Buttons,Graphics,Dialogs;
type
TprSpeedButton = class(TSpeedButton)
private
{ Private declarations }
procedure MouseEnter(var msg : TMessage);message cm_mouseenter;
procedure MouseLeave(var msg : TMessage);message cm_mouseleave;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('PR Controls', [TprSpeedButton]);
end;
{ TprSpeedButton }
procedure TprSpeedButton.MouseEnter(var msg: TMessage);
begin
inherited;
Font.Color := clHotLight;
ShowMessage('Hello');
end;
procedure TprSpeedButton.MouseLeave(var msg: TMessage);
begin
inherited;
font.Color := clDefault;
end;
end.
unit prSpeedButton;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Buttons,Graphics,Dialogs;
type
TprSpeedButton = class(TSpeedButton)
private
{ Private declarations }
procedure MouseEnter(var msg : TMessage);message cm_mouseenter;
procedure MouseLeave(var msg : TMessage);message cm_mouseleave;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('PR Controls', [TprSpeedButton]);
end;
{ TprSpeedButton }
procedure TprSpeedButton.MouseEnter(var msg: TMessage);
begin
inherited;
Font.Color := clHotLight;
ShowMessage('Hello');
end;
procedure TprSpeedButton.MouseLeave(var msg: TMessage);
begin
inherited;
font.Color := clDefault;
end;
end.