天
天梦
Unregistered / Unconfirmed
GUEST, unregistred user!
我自己写了一个增强型Label, 鼠标移上去会变色, 在一般的Form上运行
没问题, 但是放在ActiveXForm上就不起作用了, WHY? 源代码如下
还有,Delphi里的手形光标没有Windows98里的手形光标好看,怎样才能
用Windows98里的手形光标?
type
TLightLabel = class(TLabel)
private
{ Private declarations }
FSaveColor: TColor;
FSaveCursor: TCursor;
FLightColor: TColor;
procedure SetLightColor(value: TColor);
protected
{ Protected declarations }
procedure CMMouseEnter(var Msg: TMessage)
message CM_MOUSEENTER;
procedure CMMouseLeave(var Msg: TMessage)
message CM_MOUSELEAVE;
public
{ Public declarations }
constructor Create(AOwner: TComponent)
override;
published
{ Published declarations }
property LightColor: TColor read FLightColor write SetLightColor default clWindow;
end;
procedure Register;
implementation
procedure TLightLabel.SetLightColor(value: TColor);
begin
if FLightColor <> value then
begin
FLightColor := value;
end;
end;
procedure TLightLabel.CMMouseEnter(var Msg: TMessage);
begin
inherited;
if (Parent=nil) or (not Visible) or (csDesigning in ComponentState) then
exit;
FSaveColor := Font.Color;
Font.Color := FLightColor;
FSaveCursor := Cursor;
Cursor := crHandPoint;
Invalidate;
end;
procedure TLightLabel.CMMouseLeave(var Msg: TMessage);
begin
inherited;
if (Parent=nil) or (not Visible) or (csDesigning in ComponentState) then
exit;
Font.Color := FSaveColor;
Cursor := FSaveCursor;
Invalidate;
end;
constructor TLightLabel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FLightColor := clWindow;
end;
procedure Register;
begin
RegisterComponents('Standard', [TLightLabel]);
end;
没问题, 但是放在ActiveXForm上就不起作用了, WHY? 源代码如下
还有,Delphi里的手形光标没有Windows98里的手形光标好看,怎样才能
用Windows98里的手形光标?
type
TLightLabel = class(TLabel)
private
{ Private declarations }
FSaveColor: TColor;
FSaveCursor: TCursor;
FLightColor: TColor;
procedure SetLightColor(value: TColor);
protected
{ Protected declarations }
procedure CMMouseEnter(var Msg: TMessage)
message CM_MOUSEENTER;
procedure CMMouseLeave(var Msg: TMessage)
message CM_MOUSELEAVE;
public
{ Public declarations }
constructor Create(AOwner: TComponent)
override;
published
{ Published declarations }
property LightColor: TColor read FLightColor write SetLightColor default clWindow;
end;
procedure Register;
implementation
procedure TLightLabel.SetLightColor(value: TColor);
begin
if FLightColor <> value then
begin
FLightColor := value;
end;
end;
procedure TLightLabel.CMMouseEnter(var Msg: TMessage);
begin
inherited;
if (Parent=nil) or (not Visible) or (csDesigning in ComponentState) then
exit;
FSaveColor := Font.Color;
Font.Color := FLightColor;
FSaveCursor := Cursor;
Cursor := crHandPoint;
Invalidate;
end;
procedure TLightLabel.CMMouseLeave(var Msg: TMessage);
begin
inherited;
if (Parent=nil) or (not Visible) or (csDesigning in ComponentState) then
exit;
Font.Color := FSaveColor;
Cursor := FSaveCursor;
Invalidate;
end;
constructor TLightLabel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FLightColor := clWindow;
end;
procedure Register;
begin
RegisterComponents('Standard', [TLightLabel]);
end;