怎样捕捉鼠标是否在一个控件上?

方志 2001-10-19 07:49:32
我正在做一个触摸屏程序,主窗体有上四个按钮,我想达到鼠标一移至某个按钮上则按钮的字体大小、色彩变化,突出显示。请问该如何判断鼠标是否在该控件上,如何触发事件? 请指教。
...全文
103 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Rain_B 2001-10-20
  • 打赏
  • 举报
回复
CsdnKey(函数) 的方法让我想到一个问题,就是,如何遍历窗体中所有控件?比如我要寻找某个窗体中所有edit控件,并且改变其readonly属性,请问该怎么做?
CsdnKey 2001-10-19
  • 打赏
  • 举报
回复
写一过程
Procedure MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
Begin
if Sender is TSpeedButton then SpeedButton1.Font.Color:=clRed
else SpeedButton1.Font.Color:=clBlue;
end;
让主窗体的 OnMouseMove=MouseMove
在窗体上放置几个 SpeedButton 按钮 也让其OnMouseMove=MouseMove
一切那么简单 试一试
rolinyang 2001-10-19
  • 打赏
  • 举报
回复
假設一component是button1;
procedure Tform1.mousemove(sender:tobject;shift:tshiftstate;x,y:integer);
with button1 do
if x>left and x<(left+width) and y>top and y<(top+height) then do (what you want)
............

end;


OK,Give Me score!!!!!!!!!


方志 2001-10-19
  • 打赏
  • 举报
回复
up
方志 2001-10-19
  • 打赏
  • 举报
回复
HELP ME
方志 2001-10-19
  • 打赏
  • 举报
回复
能不能提供一段代码?
Rain_B 2001-10-19
  • 打赏
  • 举报
回复
var
location :tpoint;
produce form.formmousemove(...)
begin
win32check(GetCursorPos(location));
if location.x = ... and location.y = ... then
begin
...
...
end;
end;
xsbchen 2001-10-19
  • 打赏
  • 举报
回复
WM_MOUSEMOVE
WM_MOUSELEAVE
CsdnKey 2001-10-19
  • 打赏
  • 举报
回复
用OnMouseMove事件

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧