Drag and drop to custom task pane in Excel VSTO

Arr, I'm stuck!

I am writing an Excel add-in that opens a custom taskbar (it is a tool such as data analysis). In the interest of performance, I want the user to be able to drag an object, such as a file or email attachment, onto part of this taskbar for processing, instead of going through one or more file dialogs.

The problem is that Excel seems to completely override the drag and drop properties of the taskbar and the controls it contains, so when I drop the file into the taskbar, Excel just tries to open it as a spreadsheet (and succeeds if it's a supported type file), and my DragDrop event never fires.

Is there a way to get Excel to stop doing this so that the forwarding event is sent to the taskbar?

+6
source share
1 answer

Ok, I found a way. It turns out that the DragDrop event does not fire, because Excel handles all drag and drop events, but the DragEnter event fires, and when possible, I can open a modeless form on top of the actual return target. This form can then receive the DragDrop event (and kill itself in the DragLeave event). It's a little hack, but it seems to work well.

+4
source

Source: https://habr.com/ru/post/885944/


All Articles