簡體   English   中英

在管理員帳戶中運行Visual Studio時無法觸發拖放事件

[英]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開始,您無法從運行在較低完整性級別的應用程序拖放到運行在較高完整性級別的應用程序。水平。”

參見http://blogs.msdn.com/b/patricka/archive/2010/01/28/q-why-doesn-t-drag-and-drop-work-when-my-application-is-running-elevated -強制性完整性控制和uipi.aspx,以獲取詳細信息

PS引用重復的注釋也是正確的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM