I have a Form object with a title bar displayed.
我有一个Form对象,显示标题栏。
I need a pure managed way(P/Invoke-free, both Mono and .NET compatible, preferrably a .NET 2.0 API) to detect when the FORM itself starts being dragged, changes location and when it is dropped(not any content).
我需要一种纯托管方式(P / Invoke-free,Mono和.NET兼容,最好是.NET 2.0 API)来检测FORM本身何时开始被拖动,更改位置以及何时删除(不是任何内容)。
I did this in the past in Mono but I don't remember how anymore and I don't know if my solution was MS.NET-compatible...
我过去在Mono做过这个,但我不记得怎么了,我不知道我的解决方案是否与MS.NET兼容......
If anyone could provide an example, three event names for me to google more details or point me to a relevant * question, I would greatly appreciate. So far, my search has returned no relevant results...
如果有人可以提供一个示例,我可以通过三个事件名称来查看更多详细信息或指向相关的*问题,我将不胜感激。到目前为止,我的搜索没有返回任何相关结果......
1 个解决方案
#1
Are you talking actual drag-drop operation here, or when the user moves the form? If it is the movement itself, you might be able to use the ResizeBegin
event, which is raised when the user starts to move the form. This together with LocationChanged
and ResizeEnd
should cover your needs. However, the ResizeBegin
and ResizeEnd
events are (of course) also raised when you start and end resizing the form, not only when you are moving it.
你在这里谈论实际的拖放操作,或者当用户移动表单时?如果它是移动本身,您可能能够使用ResizeBegin事件,该事件在用户开始移动表单时引发。这与LocationChanged和ResizeEnd一起应该满足您的需求。但是,ResizeBegin和ResizeEnd事件(当然)也会在您开始和结束调整表单时引发,不仅仅是在您移动它时。
#1
Are you talking actual drag-drop operation here, or when the user moves the form? If it is the movement itself, you might be able to use the ResizeBegin
event, which is raised when the user starts to move the form. This together with LocationChanged
and ResizeEnd
should cover your needs. However, the ResizeBegin
and ResizeEnd
events are (of course) also raised when you start and end resizing the form, not only when you are moving it.
你在这里谈论实际的拖放操作,或者当用户移动表单时?如果它是移动本身,您可能能够使用ResizeBegin事件,该事件在用户开始移动表单时引发。这与LocationChanged和ResizeEnd一起应该满足您的需求。但是,ResizeBegin和ResizeEnd事件(当然)也会在您开始和结束调整表单时引发,不仅仅是在您移动它时。