Arr, I am stuck!
I'm writing an Excel add-in that opens up a custom task pane (it's a data analysis tool type of thing). In the interest of productivity I want to enable the user to drag an object, such as a file or email attachment, onto a part of that task pane for processing, rather than have to go through one or more file dialogs.
The problem is that Excel seems to completely override the drag/drop properties of the custom task pane and 开发者_高级运维the controls it contains, so that when I drop a file onto the task pane, Excel simply tries to open it as a spreadsheet (and succeeds if it's a supported file type), and my DragDrop event never fires.
Is there any way to make Excel stop doing this so the drop event gets sent to the task pane?
Ok, I found a way. It turns out the DragDrop event won't fire as Excel handles all drag events itself, but the DragEnter event does fire, and when it does I can open a modeless form on top of the actual drop target. This form can then receive the DragDrop event (and kills itself on the DragLeave event). It's a bit of a hack, but it seems to be working nicely.
精彩评论