焦点问题 我想实现这样一个东东 比如shape控件,我想把鼠标移上去时就变色,移开时恢复,原来我是在MOUSEMOVE中做的,移开时在别的控件写,把它变回来,但有缺陷,因为移到FORM外就不行了,请问有什么好方法,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先看看这个unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } public { Public declarations } end;Type TShape1 =class (TShape) private procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; end;var Form1: TForm1; Shape1: TShape1;implementation{$R *.dfm}{ TShape1 }procedure TShape1.CMMouseEnter(var Message: TMessage);begin Form1.Caption := 'Y';end;procedure TShape1.CMMouseLeave(var Message: TMessage);begin Form1.Caption := 'N';end;procedure TForm1.FormCreate(Sender: TObject);begin Shape1 := TShape1.Create(Form1); Shape1.Parent := Form1; Shape1.Align := alClient;end;procedure TForm1.FormDestroy(Sender: TObject);begin Shape1.Free;end;end. 这个方法可能有些笨,不过我测试过了,符合你的要求:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Timer1: TTimer; Timer2: TTimer; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure Timer2Timer(Sender: TObject); private { Private declarations } public { Public declarations } end;Type TShape1 =class (TShape) private procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; end;var Form1: TForm1; Shape1: TShape1;implementation{$R *.dfm}{ TShape1 }procedure TShape1.CMMouseEnter(var Message: TMessage);begin Form1.Timer1.Enabled := True; Form1.Timer2.Enabled := False;end;procedure TShape1.CMMouseLeave(var Message: TMessage);begin Form1.Timer1.Enabled := False; Form1.Timer2.Enabled := True;end;procedure TForm1.FormCreate(Sender: TObject);begin Shape1 := TShape1.Create(Form1); Shape1.Parent := Form1; Shape1.Align := alClient;end;procedure TForm1.FormDestroy(Sender: TObject);begin Shape1.Free;end;procedure TForm1.Timer1Timer(Sender: TObject);begin if Shape1.Pen.Style <> psSolid then Shape1.Pen.Style := psSolid;end;procedure TForm1.Timer2Timer(Sender: TObject);begin if Shape1.Pen.Style <> psClear then Shape1.Pen.Style := psClear;end;end. delphi update语句的问题 在线等!! 如何将WPS文件读取到Memo或RichEdit这两个组件中? 问个delphi自带的quickrep控件控制打印的问题,急用! 如何通过捕捉消息知道键盘被按下? 有关Try.. Except..捕捉异常的问题~ 请问如何用wordapplication和worddocument打开rtf格式的文件 写入表的时候总是出错,帮我看看吧! 关于xml报表的问题。 delphi xe5 中的excel控件怎么办 那位有帮助文件制作工具的详细说明,给我一份 关于OutLook的帐号和密码问题求助 数据库与登陆密码的问题?
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Type
TShape1 =class (TShape)
private
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
end;var
Form1: TForm1;
Shape1: TShape1;
implementation{$R *.dfm}{ TShape1 }procedure TShape1.CMMouseEnter(var Message: TMessage);
begin
Form1.Caption := 'Y';
end;procedure TShape1.CMMouseLeave(var Message: TMessage);
begin
Form1.Caption := 'N';
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Shape1 := TShape1.Create(Form1);
Shape1.Parent := Form1;
Shape1.Align := alClient;
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
Shape1.Free;
end;end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Type
TShape1 =class (TShape)
private
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
end;var
Form1: TForm1;
Shape1: TShape1;implementation{$R *.dfm}{ TShape1 }procedure TShape1.CMMouseEnter(var Message: TMessage);
begin
Form1.Timer1.Enabled := True;
Form1.Timer2.Enabled := False;
end;procedure TShape1.CMMouseLeave(var Message: TMessage);
begin
Form1.Timer1.Enabled := False;
Form1.Timer2.Enabled := True;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Shape1 := TShape1.Create(Form1);
Shape1.Parent := Form1;
Shape1.Align := alClient;
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
Shape1.Free;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Shape1.Pen.Style <> psSolid then
Shape1.Pen.Style := psSolid;
end;procedure TForm1.Timer2Timer(Sender: TObject);
begin
if Shape1.Pen.Style <> psClear then
Shape1.Pen.Style := psClear;
end;end.