![](/img/trans.png)
[英]I have enabled drag and drop in the datagrid but the event handler is not fired
[英]Drag and drop event can not be fired when running visual studio in Administrator account
我使用Visual Studio 2008,.net Framework 3.5
我有一個Web服務應用程序(一個正在使用Web Service的Winform客戶端),我必須以管理員帳戶運行它
我需要將文件從Windows資源管理器拖放到此應用程序的一種形式。
這是我的代碼:
this.AllowDrop = true;
private void Form1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
e.Effect = DragDropEffects.All;
}
private void Form1_DragDrop(object sender, DragEventArgs e)
{
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
foreach (string s in fileList)
{
MessageBox.Show(s);
}
}
當我在普通帳戶中運行時它可以工作,但在管理員中卻不能。 怎么解決呢?
在這里也提出了這個問題: 拖放在C#中不起作用答案是,“由於用戶界面特權隔離,從Windows Vista開始,您無法從運行在較低完整性級別的應用程序拖放到運行在較高完整性級別的應用程序。水平。”
PS引用重復的注釋也是正確的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.