private void MainForm_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); if (tempo == 0) { if (files.Length > 1) { MessageBox.Show("Please put only one file at the time"); } else { foreach (var file in files) { //MessageBox.Show(file); App.Struture.Structure structFunction = new App.Struture.Structure(); structFunction.Launch(file); CreateForm secondForm = new CreateForm(); secondForm.Show(); } var strip = new Controls.MainMenuStrip(); strip.openFile(false); this.AllowDrop = false; } tempo = 1; } else { tempo = 0; } }
public MainForm() { InitializeComponent(); Controls.MainMenuStrip menuStrip = new Controls.MainMenuStrip(); Controls.Add(menuStrip); this.AllowDrop = true; this.DragEnter += new DragEventHandler(MainForm_DragEnter); this.DragDrop += new DragEventHandler(MainForm_DragDrop); }