如何检测用户是否在Access 2007中拖动了表单 [英] How can I detect whether a user has dragged a form in Access 2007

查看:89
本文介绍了如何检测用户是否在Access 2007中拖动了表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



在我的Access 2007项目中,我想保持一个菜单形式始终打开以充当主交换机。我正在重叠窗口设置中工作。菜单表单是一个弹出窗体,所以当拖动菜单后,所有其他表单都会消失。



如果用户将表单拖到菜单表格后面太远,那么表单边框的拖动部分隐藏在菜单后面,然后他将无法检索表单。因此,我希望在用户拖动表单并释放鼠标后触发事件。在这种情况下,我可以检查表单是否在菜单后面,并在必要时重新定位。有谁知道怎么做?



我可以使用在后台运行的计时器事件来模仿这种行为,每100ms检查一个表单是否需要重新定位。然而,这当然会保持一直运行,即使用户没有在任何地方拖动任何形式。有没有人有另一个想法,避免在后台运行这个常量计时器?



如果能检测到鼠标按下,鼠标移动和鼠标移动事件就足够了在表格的边框(不在表格的正文)。但是,这似乎不能直接在Access中使用。

我已经尝试设置一个Windows钩子来捕捉鼠标点击事件以检测鼠标点击表格边框。由于我对子类化一无所知,这些尝试失败了,我的应用程序一直崩溃...



我会很感激任何其他的想法。

干杯,Max

Hi all,

in my Access 2007 project, I would like to keep a "menu" form always open to act as the main switchboard. I am working in the "overlapping windows" setting. The menu form is a popup form, so all other forms disappear when dragged behind the menu.

If a user drags his form too far behind the menu form, so that the dragging portion of the form border is hidden behind the menu, then he will have no chance of retrieving the form. Therefore I would like to have an event that fires after a user has dragged a form and released the mouse. In this event, I could then check whether the form is behind the menu, and reposition it if necessary. Does anyone know how to do this?

I can mimic this behaviour using a timer event running in the background, checking every 100ms whether a form needs to be repositioned. However, this of course keeps running the whole time, even if the user hasn't dragged any form anywhere. Does anyone have an alternative idea avoiding this constant timer running in the background?

It would suffice if I could detect mouse-down, mouse-move and mouse-up events on the border of the form (NOT on the body of the form). However, this does not seem possible directly in Access.
I have experimented setting a windows hook to catch mouse click events to detect the mouse click on the form border. As I am quite clueless regarding subclassing, these attempts failed miserably and my application kept crashing...

I would be grateful for any other ideas.
Cheers, Max

推荐答案

它可能对你有所帮助:鼠标悬停/悬停显示弹出窗口,Access 2007 [ ^ ]



其他资源:

访问表单:OnMouseOver效果 [ ^ ]

简单的Microsoft Access MouseOver和MouseOut自定义事件 [ ^ ]
It might help you: Mouseover/hover Show Popup, Access 2007[^]

Other resources:
Access Forms: OnMouseOver Effect[^]
Simple Microsoft Access MouseOver and MouseOut Custom Events[^]


这篇关于如何检测用户是否在Access 2007中拖动了表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆