コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool salida = false;

            foreach (Form frm in this.MdiChildren)
            {
                if (frm is FrmMensaje)
                {
                    salida = true;
                }
            }
            if (!salida)
            {
                FrmMensaje men = new FrmMensaje();
                men.MdiParent = this;
                foreach (Form frm in this.MdiChildren)
                {
                    if (frm is FrmAccion)
                    {
                        ((FrmAccion)frm).enviarMens += men.mostrarMensaje;
                    }
                }
                men.Show();
                men.Focus();
            }
        }
コード例 #2
0
        private void btnMostrarMsj_Click(object sender, EventArgs e)
        {
            foreach (Form item in this.MdiChildren)
            {
                if (item is FrmMensaje)
                {
                    item.Focus();
                    return;
                }
            }
            FrmMensaje msg = new FrmMensaje();

            msg.MdiParent = this;
            msg.Show();
            foreach (Form item in this.MdiChildren)
            {
                if (item is FrmAccion)
                {
                    item.Focus();
                    ((FrmAccion)item).eventMsg += msg.mostrarMensaje;
                    return;
                }
            }
        }