簡體   English   中英

在表單中拖放仍然禁用

[英]Drag'n'Drop in form still disabled

通常,此屬性足夠(簡短版本):

namespace DiapoWin
{
    partial class mainWindow
    {
        private void InitializeComponent()
        {
            this.AllowDrop = true;

對於主窗體和ListBox(假定為拖放目標),AllowDrop設置為true。

這是我的事件處理程序(來自本文 ):

private void listImages1_DragDrop(object sender, DragEventArgs e)
{
    if (e.Data.GetDataPresent(DataFormats.FileDrop))
    {
        string[] fileNames = (string[])e.Data.GetData(DataFormats.FileDrop);
        TextDelai.Lines = fileNames;
    }
}

private void listImages1_DragEnter(object sender, DragEventArgs e)
{
    if (e.Data.GetDataPresent(DataFormats.FileDrop))
    {
        e.Effect = DragDropEffects.Copy;
    }
 }

但是在嘗試刪除文件夾(甚至包含文件)時,我仍然收到forbidden鼠標光標。 有任何想法嗎?

好的, 這篇文章是閱讀的。 關閉並重新啟動沒有管理員權限的Visual Studio,它可以運行:(

暫無
暫無

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

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