public Config_form(Main main, Graphic_form plotter)//recebe o endereço do main e do plotter { InitializeComponent(); InstanciaMain = main;//permite o acesso as funcções do main InstanciaPlotter = plotter; }
/*--------Menu Strip---------*/ private void tsm_Tools_Plotter_Click(object sender, EventArgs e) //abre o plotter { if (Application.OpenForms.OfType <Graphic_form>().Count() == 0) //verifica se ja existe uma aba aberta { Form_plotter = new Graphic_form(); //instancia o formulario filho //descobre a posição do form principal para centralizar o filho int x = this.Left + (this.Width / 2) - (Form_plotter.Width / 2); int y = this.Top + (this.Height / 2) - (Form_plotter.Height / 2); Form_plotter.Location = new Point(x, y); //seta a posição do formulario filho Form_plotter.Show(); //exibe o formulario filho } else { Form_plotter.Focus();//caso a janela ja esteja aberta, foca na mesma } }