Home > other >  [for] the Unity inside can use the System. Windows. Forms DragDrop and DragEnter method
[for] the Unity inside can use the System. Windows. Forms DragDrop and DragEnter method

Time:09-20

I want to open the U3D release PC window, the realization of desktop files into the window display selected file path, the Internet is in the inside of the winform, I applied a DLL, but no effect

using System;
Using System. The Collections;
using System.Collections.Generic;
using System.Windows.Forms;
Using UnityEngine;
Using UnityEngine. UI;

Public class Test: MonoBehaviour {

Public Text TXT.

Private void the Start ()
{
Form1 form=new _click (TXT);
}
}

Public class Form1: Form
{
The Text TXT.
Public _click (Text TXT)
{
This. TXT=TXT;
InitializeComponent ();
}

Private void InitializeComponent ()
{
Enclosing AllowDrop=true;
Enclosing DragDrop +=new DragEventHandler (enclosing Form1_DragDrop);
Enclosing DragEnter +=new DragEventHandler (enclosing Form1_DragEnter);
}

Private void Form1_DragDrop (object sender, DragEventArgs e)
{
TXT text=((System. Array) e.D ata. GetData (DataFormats. FileDrop)). The GetValue (0). The ToString ();
}

Private void Form1_DragEnter (object sender, DragEventArgs e)
{
If (e.D ata. GetDataPresent (DataFormats. FileDrop))
E.E ffect=DragDropEffects. Link;
The else e.E ffect=DragDropEffects. None;
}
}
  • Related