In my program, I need the following routine to work:
private void FuncaoTal()
{
frmSelecao.FormClosing += atualizarEvento;
SplitContMenu.Panel2.Controls.Clear();
splitContMenu.Panel2.Controls.Add(frmSelecao);
frmSelecao.Show();
}
private void atualizarEvento(Object sender, EventArgs e)
{
if (ContaAtiva.id == 0)
{
sender(as Form).FormClosed += carregarLogoVanguarda;
}
else
{
sender(as Form).FormClosed += acessarMenuMovimentacoes;
}
}
public void acessarMenuMovimentacoes(object sender, EventArgs e)
{
frmMenuMovimentacao frm = new frmMenuMovimentacao();
frm.AutoScroll = true;
frm.Dock = DockStyle.Fill;
frm.TopLevel = false;
splitContMenu.Panel2.Controls.Clear();
splitContMenu.Panel2.Controls.Add(frm);
frm.FormClosed += carregarLogoVanguarda;
if (ContaAtiva.id > 0)
{
frm.Show();
}
}
private void carregarLogoVanguarda(object sender, EventArgs e)
{
PictureBox picBoxLogo = new PictureBox();
picBoxLogo.Image = global::InterfaceVisual.Properties.Resources.Logo_Vanguarda;
picBoxLogo.Dock = DockStyle.Fill;
picBoxLogo.SizeMode = PictureBoxSizeMode.CenterImage;
picBoxLogo.BackColor = Color.White;
splitContMenu.Panel2.Controls.Clear();
splitContMenu.Panel2.Controls.Add(picBoxLogo);
}
I'm not able to make the routine update event work.
It is my intention that when the user selects an account in the selection screen, the screen is closed and in its place another one is opened. Otherwise, it loads the home screen again.
Qs: I'm using SplitContainer
. The screens are loaded in panel 2
of it.