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; } }
private void CreateAccountButton_Click(object sender, EventArgs e) { CreateForm m = new CreateForm(); m.TopLevel = false; m.AutoScroll = true; ContentPanel.Controls.Clear(); ContentPanel.Controls.Add(m); m.Dock = DockStyle.Fill; m.Show(); }
public void FileDropDownMenu() { var fileDropDownMenu = new ToolStripMenuItem("File"); //var newMenu = new ToolStripMenuItem("New", null, null, Keys.Control | Keys.N); var openMenu = new ToolStripMenuItem("Open", null, null, Keys.Control | Keys.O); //var saveMenu = new ToolStripMenuItem("Save", null, null, Keys.Control | Keys.S); //var saveAsMenu = new ToolStripMenuItem("Save As", null, null, Keys.Control | Keys.Shift | Keys.N); var quitMenu = new ToolStripMenuItem("Quit", null, null, Keys.Alt | Keys.F4); openMenu.Click += (object sender, EventArgs e) => { if (_openFileDialog.ShowDialog() == DialogResult.OK && canOpenFile == true) { //_form.Text = $"{_openFileDialog.FileName} - MiniStructure"; Structure structFunction = new Structure(); structFunction.Launch(_openFileDialog.FileName); CreateForm secondForm = new CreateForm(); secondForm.Show(); var form = new MainForm(); form.AllowDrop = false; canOpenFile = false; } else { MessageBox.Show("You can't open a file. Close the 'Make your Struture' window"); } }; quitMenu.Click += (object sender, EventArgs e) => { _form.Close(); }; fileDropDownMenu.DropDownItems.AddRange(new ToolStripItem[] { /*newMenu,*/ openMenu, /*saveMenu, saveAsMenu,*/ quitMenu }); Items.Add(fileDropDownMenu); }