DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: lixuan123
今日帖子: 0
在线用户: 4
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 qq66533885 (qq66533885) ★☆☆☆☆ -
盒子活跃会员
2004/6/20 16:04:58
标题:
路过可要进来看看哦! 浏览:1089
加入我的收藏
楼主: button1.Left :=20;
button1.top:=20;
button1.width:=50;
button1.height:=50;

当鼠标移到button上方时,发生事件。不能用OnMouseMove

----------------------------------------------
Delphi学习ing
作者:
男 zsredmoon (=^@^=) ★☆☆☆☆ -
盒子活跃会员
2004/6/20 18:54:39
1楼: 按此在新窗口浏览图片 ……路过,不懂……
----------------------------------------------
按此在新窗口浏览图片
=^@^=
作者:
男 studier (清风) ★☆☆☆☆ -
盒子活跃会员
2004/6/20 18:59:55
2楼: 用计数器可以实现吧?
使用计数器不断检测光标坐标(point),若坐标处于button1上,就触发事件,OK?
----------------------------------------------
简简单单就好
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/6/20 19:33:16
3楼: procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnMessage := AppMessage;
end;

procedure TForm1.AppMessage(var Msg: tagMSG; var Handled: Boolean);
begin
  if (Msg.hwnd = Button1.Handle) and (Msg.message = WM_MOUSEMOVE) then
    ShowMessage('11');
end;

----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
作者:
男 studier (清风) ★☆☆☆☆ -
盒子活跃会员
2004/6/20 19:36:07
4楼: 老大就是老大,佩服,学习
----------------------------------------------
简简单单就好
作者:
男 willing (willing) ★☆☆☆☆ -
禁用账号
2004/6/20 20:22:56
5楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
按此在新窗口浏览图片
作者:
男 qq66533885 (qq66533885) ★☆☆☆☆ -
盒子活跃会员
2004/6/20 22:13:58
6楼: 老大,我编译不过啊,还缺少什么吗?

要是用二楼的方面,要怎么做啊?
----------------------------------------------
Delphi学习ing
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/6/20 22:18:43
7楼: 可以的
只是记得AppMessage是个类成员函数,要在TForm1里声明

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure AppMessage(var Msg: tagMSG; var Handled: Boolean);
  public
    { Public declarations }
  end;

.............

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnMessage := AppMessage;
end;

procedure TForm1.AppMessage(var Msg: tagMSG; var Handled: Boolean);
begin
  if (Msg.hwnd = Button1.Handle) and (Msg.message = WM_MOUSEMOVE) then
    ShowMessage('11');
end;
----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/6/20 22:22:29
8楼: 用2楼的方法

先放一个Timer,Interval可以设置为100,然后在他的OnTimer里写
procedure TForm1.Timer1Timer(Sender: TObject);
var
  Pt: TPoint;
begin
  GetCursorPos(Pt);
  Windows.ScreenToClient(Button1.Parent.Handle, Pt);
//  or
//  Pt := Button1.Parent.ScreenToClient(Pt);

  if PtInRect(Button1.BoundsRect, Pt) then ShowMessage('22');
end;
----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS