private void loadedHosts_MouseDoubleClick(object sender, MouseEventArgs e) { // Get the name of the file to open from the ListBox. ListView.SelectedListViewItemCollection items = loadedHosts.SelectedItems; ListViewItem lvItem = items[0]; string ipa = lvItem.SubItems[0].Text; string doa = lvItem.SubItems[1].Text; FormCollection formCollection = Application.OpenForms; foreach (Form form in formCollection.Cast <Form>().ToList()) { if (form is hosteditor.editForm) { editorForm.Close(); } } editorForm = new hosteditor.editForm(this); editorForm.Show(); editorForm.Left = this.Location.X + ((this.Width / 2) - editorForm.Width); editorForm.Top = this.Location.Y + ((this.Height / 2) - editorForm.Height); editorForm.TopMost = true; editorForm.AddMode = false; editorForm.setIP(ipa); editorForm.setDomains(doa); }
public mainForm() { InitializeComponent(); this.Width = 522; this.Height = 353; this.Height = 85; editorForm = new hosteditor.editForm(this); }
private void buttonAddHost_Click(object sender, EventArgs e) { FormCollection formCollection = Application.OpenForms; foreach (Form form in formCollection.Cast <Form>().ToList()) { if (form is hosteditor.editForm) { editorForm.Close(); } } editorForm = new hosteditor.editForm(this); editorForm.AddMode = true; editorForm.Show(); editorForm.Left = this.Location.X + ((this.Width / 2) - editorForm.Width); editorForm.Top = this.Location.Y + ((this.Height / 2) - editorForm.Height); editorForm.TopMost = true; }