Requirements: Write a PC-side (Window) Excel guide to your planners. Originally with OpenFile open Fileexplorerdialog after let them choose to add Excel file on the line, the result has a demand is to drag and drop Excel file directly added, think this is more convenient.
Desktop applications with WinForm and WPF to write, this feature should be very good to do, with unity to do is compared to the egg hurt ... Check it out. More is the API that calls Win32.
To summarize, you need to drag the file Manager to select files, and drag-and-drop file selection by mouse.
The key points of this guide tool are:
1. Import Excel files in normal way. Unity with Ugui to make a good interface, do an item template (can be used as a prefab preform), click the button to open Fileexplorerdialog, multi-select Excel file, press OK, dynamically generated item added to ScrollView content. The content under ScrollView is required to add the content Size fitter and grid Layout group components. This type of import is recommended with the Crosstale Filebrowser plugin (here).
2. Add files by dragging and dropping files to the App window under window platform. It is recommended to use this tool (here), mainly C # to invoke the Win32 API. There are examples of usages in the FileDragAndDrop.cs file. Add a word to the MessageBox output and drag it into the app's file path:
voidOnfiles (list<string>pathList, point APos) { //Do something with the dropped file names. APos would contain the//mouse position within the window where the files has been dropped.Debug.Log ("Dropped"+pathlist.count+"files at:"+ APos +"\ n"+Pathlist.aggregate ((A, B)= A +"\ n"+b)); StringBuilder SB=NewStringBuilder (); Sb. Append ("drag the file in. \ n"); foreach(varPathinchpathList) {sb. Append (path); Sb. Append (". \ n"); } MessageBox.Show (sb.) ToString ());}
Test, drag the file after running, the effect is as follows:
Unity output PC-side (Windows) Drag and drop files into the app