Administrador.wfAdminitrador.CargarFormulario C# (CSharp) Метод

CargarFormulario() приватный Метод

private CargarFormulario ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void CargarFormulario(object sender, EventArgs e)
        {
            Form Cargar = new Form();
            if (sender is ToolStripButton)
            {
                var vBoton = (ToolStripButton)sender;
                if (vBoton.Tag != null) { Cargar = (Form)vBoton.Tag; }
            }
            else
            {
                if (sender is ToolStripMenuItem)
                {
                    var vMenuItem = (ToolStripMenuItem)sender;
                    if (vMenuItem.Tag != null) { Cargar = (Form)vMenuItem.Tag; }
                }
                else
                {
                    if (sender is ToolStripDropDownButton)
                    {
                        var vBotonDesp = (ToolStripDropDownButton)sender;
                        if (vBotonDesp.Tag != null) { Cargar = (Form)vBotonDesp.Tag; }
                    }
                }
            }
            try
            {
                if (fFormAnterior != null) { fFormAnterior.Hide(); }
                    Assembly asm = Assembly.GetEntryAssembly();
                    fFormularioPrincipal = new Form();
                    fFormularioPrincipal = Cargar;
                    fFormularioPrincipal.Activate();
                    fFormularioPrincipal.FormBorderStyle = FormBorderStyle.None;
                    fFormularioPrincipal.Dock = DockStyle.Fill;
                    fFormularioPrincipal.Size = new System.Drawing.Size(this.Width,this.Height);
                    fFormularioPrincipal.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                    fFormularioPrincipal.MdiParent = wfAdminitrador.ActiveForm;
                    fFormularioPrincipal.Show();
                    fFormAnterior = fFormularioPrincipal;          
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }