有没有办法暂停 ActiveX 控件 (MapPoint) 或异步运行 DoDragDrop?

发布于 2024-10-13 04:46:50 字数 422 浏览 1 评论 0原文

我目前正在开发一个带有 MapPoint-Control 的应用程序,这给我带来了困难。 从线程(mappoint 也使用该线程)启动 DoDragDrop 后,几秒钟后我总是会从 Mappoint 收到一个对话框,说我的表单没有反应。

MapPoint-Control 是一个ActiveX-Control,使用MapPoint 控件在后台启动并在不同的线程中运行。我认为 Mappoint 尝试更新控件但超时。

有没有办法在不同的线程中运行 DoDragDrop ,以便 MapPoint 从主线程获取响应。 或者是否可以告诉 MapPoint 我的表单当前已暂停。或者我可以以某种方式暂停 MapPoint 吗?

我尝试使用表单控件和 MapPoint-Control 运行 DoDragDrop

I currently working on a application with a MapPoint-Control, which gives me a hard time.
After starting a DoDragDrop from the thread, which mappoint also uses, i always get after a few secondes a dialog from mappoint saying my form doesn't react.

The MapPoint-Control is a ActiveX-Control, using the control MapPoint starts in the background and runs in a different thread. I think Mappoint trys to update the control but gets a timeout.

Is there a way to run DoDragDrop in a different thread, so MapPoint get response from the mainthread.
Or is it possible to tell MapPoint my form is currently paused. Or can I somehow pause MapPoint?

I have tried to run the DoDragDrop with the form control and with the MapPoint-Control

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨曦慕雪 2024-10-20 04:46:50

我已经找到问题了。

我已在 BeforeClick 事件上触发了 DoDragDrop。 MapPoint 可能会等待事件回调,但不会得到回调,因为 DoDragDrop 会保持事件一直持续到鼠标被释放为止。

现在我已经编写了一个事件,它启动与 MapPoint BeforeClick 事件异步的 DoDragDrop 事件。

代码:


public event InitDragDropHandler InitDragDrop;
public delegate void InitDragDropHandler(object sender, object data);

public main()
{
    this.InitDragDrop += new InitDragDropHandler(main_InitDragDrop);
}

void mappoint_BeforeClick(object sender, AxMapPoint._IMappointCtrlEvents_BeforeClickEvent e)
{
    if (InitDragDrop != null)
    {
        this.BeginInvoke(new ThreadStart(() =>
            {
                InitDragDrop(mappoint, pps);
            }));
    }
}


void main_InitDragDrop(object sender, object data)
{
    ((Control)sender).DoDragDrop(data, DragDropEffects.Copy);
}

I've found the problem.

I've fired DoDragDrop on the BeforeClick-Event. MapPoint probably wait for the Events callback, but don't get one because DoDragDrop keeps the Event up until the mouse is released.

Now i have written a Event which starts the DoDragDrop Event async to the MapPoint BeforeClick-Event.

Code:


public event InitDragDropHandler InitDragDrop;
public delegate void InitDragDropHandler(object sender, object data);

public main()
{
    this.InitDragDrop += new InitDragDropHandler(main_InitDragDrop);
}

void mappoint_BeforeClick(object sender, AxMapPoint._IMappointCtrlEvents_BeforeClickEvent e)
{
    if (InitDragDrop != null)
    {
        this.BeginInvoke(new ThreadStart(() =>
            {
                InitDragDrop(mappoint, pps);
            }));
    }
}


void main_InitDragDrop(object sender, object data)
{
    ((Control)sender).DoDragDrop(data, DragDropEffects.Copy);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文