Exemple #1
0
        private void listBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.textBoxSearch.Text = Path.GetFileName(listBox.SelectedItem.ToString());
            fs.fileSelected         = this.textBoxSearch.Text;
            fs.selectedFile         = listBox.SelectedItem.ToString();
            Myform myform = new Myform();

            myform.Show();
        }
Exemple #2
0
 private void openfiles_Click(object sender, EventArgs e)
 {
     if (listBox.SelectedIndex != -1)
     {
         this.textBoxSearch.Text = listBox.SelectedItem.ToString();
     }
     if (this.textBoxSearch.Text == null || this.textBoxSearch.Text == string.Empty)
     {
         MessageBox.Show("请选择需要打开的文件!", "提示");
     }
     else
     {
         fs.fileSelected = this.textBoxSearch.Text;
         fs.selectedFile = fs.rootDirectory + "/" + this.textBoxSearch.Text;
         if (File.Exists(fs.selectedFile))
         {
             Myform myform = new Myform();
             myform.Show();
         }
     }
 }
Exemple #3
0
        //METODO PARA ABRIR FORMULARIO DENTRO DE PANEL PERO TODO EL ANCHO FILL
        private void OpenFormFill <Myform>() where Myform : Form, new()
        {
            Form formulario;

            formulario = panelchildform.Controls.OfType <Myform>().FirstOrDefault();
            if (formulario == null)
            {
                formulario                 = new Myform();
                formulario.TopLevel        = false;
                formulario.FormBorderStyle = FormBorderStyle.None;
                formulario.Dock            = DockStyle.Fill;
                panelchildform.Controls.Add(formulario);
                panelchildform.Tag = formulario;
                formulario.Show();
                formulario.BringToFront();
            }
            else
            {
                //formulario.Close();
                formulario.BringToFront();
            }
        }