请问如何编写一个控件的的Enter和Leave事件!急用....请各位帮忙.....(0分)

L

luky_99

Unregistered / Unconfirmed
GUEST, unregistred user!
请问如何编写一个控件的的 MouseEnter 和 MouseLeave 事件!急用....请各位帮忙.....
如果哪位已有例子的程序或代码的可以e_amil给我吗:我的E_amil是
huangxiaomin163@163.net
 
给你个按钮的例子:
unit QButton1;

interface

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

type
TButton1 = class(TButton)
private FOnMouseLeave: TNotifyEvent;
procedure WZMouseLeave(var Msg:TMessage); message CM_MOUSELEAVE;
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
{ Published declarations }
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Samples', [TButton1]);
end;

procedure TButton1.WZMouseLeave(var Msg: TMessage);
begin
inherited;//继承父类
if csLButtonDown in ControlState then
begin
Self.MouseUp(mbLeft,[ssLeft],0,0);
end;
if Assigned (FonMouseLeave) then FOnMouseLeave(Self);
end;
end.
 
TO gaisy :
先谢了!是了你能不能再来一个mouserenter事件吗?
luky_99
 
to gaisy 能不能帮我 shape控件编个Mouseenter 和 Mouseleave 事件!!!
发到我的e_mail上来 !!
 
接受答案了.
 

Similar threads

顶部