当用户想要通过拖放将本地文件保存在桌面上时,不要编写一个操作电子邮件消息的outlook插件。
目前我无法获得窗口的MouseDown事件。是否有我可以观察到的特定Windows消息?
有没有办法操纵当前在拖动事件中的数据?
非常感谢你的帮助!
我已经尝试过了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using System.Windows.Forms;
namespace OutlookAddIn1
{
public partial class ThisAddIn
{
Outlook.Explorer explorer;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
explorer = Application.ActiveExplorer();
explorer.BeforeItemCopy += new Outlook.ExplorerEvents_10_BeforeItemCopyEventHandler(Explorer_BeforeItemCopy);
}
private void OnDragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
MessageBox.Show("OnDragEnter");
}
void Explorer_BeforeItemCopy(ref bool cancel)
{
MessageBox.Show("copied");
}
}
}
答案 0 :(得分:0)
无需使用Windows Messages,也不需要使用MouseDown事件。你只是在使用错误的事件。你需要处理的是:
请参阅此示例:
https://www.codeproject.com/articles/9017/a-simple-drag-and-drop-how-to-example