wael mrabet
wael mrabet

Reputation: 109

Can't drag and drop a file from a windows window to a winform in windows 10

I want to drag and drop pictures from windows into a winforms despite that I have coded required methods DragDrop an DragEnter AllowDrag is true. the same app functionalty works well in other computers.

here is the code: I can't understand why DragEnter is never fired !!

private void CtrlVignette_DragEnter(object sender, DragEventArgs e) `
{
    if ((((sender != CtrlVignette) &&
       (e.Data.GetDataPresent(DataFormats.FileDrop, false) == true)) ||
        ((sender == CtrlVignette) &&
         (e.Data.GetDataPresent("objet", false) == false))) &&
       (Selectedpatient != null))
            e.Effect = DragDropEffects.All;
}

private void CtrlVignette_DragDrop(object sender, DragEventArgs e)
{
    // the code of this method is too long and it works very well
 }

CtrlVignette.AllowDrop is true

Upvotes: 0

Views: 366

Answers (1)

wael mrabet
wael mrabet

Reputation: 109

Solution : disable LUA

step 1 : open RegisterEditor.

step 2 : go under the following directory :( Ordinateur\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System )

step 3: modifie EnableLUA value form 1 to 0

step 4: restart the computer

Finally I thank you all Guys @Hans Passant @Taw, @Mohamad Shahrestani and @Mong Zhu

Upvotes: 1

Related Questions