我只是使用原panel重新生成了一个控件。
自已画很难吧?我是刚开始学,还不会那么高深的东西。
这是在程序中加入的代码:
property Tform1.PanelOnMouseMove
begin
panel.width:=300;
property Tform1.PanelOnMouseLeave
begin
panel.width:=1;
end;
我只是想,当鼠标移出时,panel的宽度是1,当鼠标移入时设为300。但当鼠标移到
panel上的Toolbar上时也会响应PanelOnMouseLeave事件?
这是panel控件的代码
unit Panel1;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls;
type
TPanel1 = class(TPanel)
private
FOnMouseLeave:TNotifyEvent;
procedure CMMouseLeave(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('Lovecs', [TPanel1]);
end;
procedure tpanel1.CMMouseLeave(var Msg: TMessage);
begin
if Assigned(FOnMouseLeave) then FOnMouseLeave(Self);
inherited;
end;
end.