Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/07/2012, 08:59
alexg88
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: Ventana o form unico

Buenas,

Una posibilidad es usar un dictionary para guardar los formularios abiertos.


Código C#:
Ver original
  1. public class FormGeneral .... {
  2.  
  3. Dictionary<Cliente,Form> formulariosClientes = new Dictionary<Cliente,Form>();
  4.  
  5. private void lstClientes_DoubleClick(object sender, EventArgs e)
  6. {
  7.  
  8. if (!formulariosClientes.ContainsKey(cliente)){
  9.  
  10. var verClienteForm = new frmVerCliente(cliente);
  11. formulariosClientes.Add(cliente,verClienteForm);
  12. verClienteForm.MdiParent = this;
  13. verClienteForm.Show();
  14. verClienteForm.BringToFront();
  15. }
  16. else{
  17.  
  18. formulariosClientes[cliente].BringToFront();
  19.  
  20. }
  21.  
  22. }
  23.  
  24. }

Y cuando cierres el formulario, tendrías que borrar el formulario del dictionary con el método Remove.

Saludos.