我自己想给TMainMenu加一个mousemove事件,如下:
unit Menu;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Shellapi, StdCtrls, ExtCtrls, Menus;
type
TMenu = class(TMainMenu)
private
{ Private declarations }
FOnMouseMove: TNotifyEvent;
procedure FSetOnMouseMove(value: TNotifyEvent);
protected
{ Protected declarations }
procedure wmmousemove(var Msg: TMessage); message WM_MOUSEMOVE;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
property OnMouseMove: TNotifyEvent read FOnMouseMove write FSetOnMouseMove;
end;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMenu]);
end;
{ TMenu }
procedure TMenu.wmmousemove(var Msg: TMessage);
begin
if Assigned(FOnMouseMove) then
FOnMouseMove(Self);
end;
constructor TMenu.Create(AOwner: TComponent);
begin
inherited;
end;
destructor TMenu.Destroy;
begin
inherited;
end;
procedure TMenu.FSetOnMouseMove(value: TNotifyEvent);
begin
if @FOnMouseMove <> @value then
FOnMouseMove := Value;
end;
end.
但用install component居然不让install!?(就是install那个按钮是灰的)是哪个地方写错了吗?以前没做过这种东西。
TMenu是一个已经存在的类
改成别的名字还是不行啊
install那个按钮是灰的
====================================================================================
你的Delphi系统有毛病,我们的都不是灰的,这与"哪个地方写错了"是两回事.但是TMenu确实是已经存在的,是TMainMenu的祖先类,还有就是主菜单是不能简单加事件的,它是Windows系统控制的,Delphi只不过包装了一下
--------------------------
新闻:
大脑推客:通过电脑思考即可发布Twitter消息网站导航:
博客园首页 新闻 .NET频道 社区 博问 闪存 找找看
阅读(587) | 评论(0) | 转发(0) |