public void Abrir_ingresar() { Principal principal = Application.OpenForms.OfType <Principal>().SingleOrDefault(); if (principal.panel1.Controls.Count > 0) { principal.panel1.Controls.RemoveAt(0); } Contenedor_controles controles = new Contenedor_controles(); controles.TopLevel = false; controles.Dock = DockStyle.Fill; principal.panel1.Controls.Add(controles); principal.panel1.Tag = controles; principal.MaximizeBox = false; int ancho = controles.Size.Width; int alto = controles.Size.Height; principal.Size = new Size(ancho, alto + 35); int deskHeight = Screen.PrimaryScreen.Bounds.Height; int deskWidth = Screen.PrimaryScreen.Bounds.Width; principal.Location = new Point((deskWidth - principal.Width) / 2, ((deskHeight - principal.Height) / 2) - 20); controles.Show(); }
//Funciones public void Abrir(Object formulario) { //Principal principal = Application.OpenForms.OfType<Principal>().SingleOrDefault(); Contenedor_controles principal = (Contenedor_controles)this; if (principal.panel1.Controls.Count > 0) { principal.panel1.Controls.RemoveAt(0); } Form controles = formulario as Form; controles.TopLevel = false; controles.Dock = DockStyle.Fill; principal.panel1.Controls.Add(controles); principal.panel1.Tag = controles; int ancho = controles.Size.Width; int alto = controles.Size.Height; principal.Size = new Size(ancho, alto + 35); controles.Show(); }
public void Abrir_ingresar() { Principal principal = Application.OpenForms.OfType <Principal>().SingleOrDefault(); string ruta = "vehiculos.txt"; camiones = new StreamReader(ruta); texto_Completo = camiones.ReadToEnd(); lineas = texto_Completo.Split('\n'); matriz_camion = new string[lineas.Length, 8]; int yy = 0; for (int a = 0; a < lineas.Length; a++) { string[] segmentos = lineas[a].Split('|'); for (int b = 0; b < segmentos.Length; b++) { matriz_camion[a, b] = segmentos[b]; } int count = 0; foreach (char h in segmentos[0]) { if (h != ' ') { count = 1; break; } } if (segmentos[0] == comboBox1.Text) { yy = 1; break; } } camiones.Close(); if (yy == 1) { principal.placas = comboBox1.Text; if (principal.panel1.Controls.Count > 0) { principal.panel1.Controls.RemoveAt(0); } Contenedor_controles controles = new Contenedor_controles(); controles.TopLevel = false; controles.Dock = DockStyle.Fill; principal.panel1.Controls.Add(controles); principal.panel1.Tag = controles; principal.MaximizeBox = false; int ancho = controles.Size.Width; int alto = controles.Size.Height; principal.Size = new Size(ancho, alto + 35); int deskHeight = Screen.PrimaryScreen.Bounds.Height; int deskWidth = Screen.PrimaryScreen.Bounds.Width; principal.Location = new Point((deskWidth - principal.Width) / 2, ((deskHeight - principal.Height) / 2) - 20); //principal.Location = Screen.PrimaryScreen.WorkingArea.Location; //principal.Size = Screen.PrimaryScreen.WorkingArea.Size; controles.Show(); } else { MessageBox.Show("El vehículo relacionado a esa placa no existe", "Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }