13
In my program, I inserted a button and a panel
. When the button is clicked, logic inserts another form into the panel
superimposing the form
initial.
In the form2
that appears has a return button, which causes the form2
disappear and reappear the form1
, but no code I try to use is working. The button code is as follows::
//FORMULÁRIO CONTEUDO
this.panel1.Controls.Clear();
Conteudo frm = new Conteudo();
frm.TopLevel = false;
panel1.Controls.Add(frm);
frm.FormBorderStyle = FormBorderStyle.None;
panel1.Height = this.Size.Height;
panel1.Width = this.Size.Width;
frm.Size = new Size(this.panel1.Width, this.panel1.Size.Height);
Application.DoEvents();
frm.Location = new Point(0 + this.panel1.AutoScrollPosition.X, 0 + this.panel1.AutoScrollPosition.Y);
panel1.BringToFront();
panel1.Visible = true;
panel1.BackColor = Color.WhiteSmoke;
frm.Show();
And in the form2
, on the button, I used the following code, and other so many variants:
Form2 frm = new Form2();
frm.Controls.Clear();
this.Close();
frm.Refresh();
If you can help me, I really appreciate it. The opening part of the form is working, but the return button to form1
does not work, when I can, using the code above, form 1 is only white.
You said you’re using [tag:webforms], correct? This one
Form
refers to the<form runat="server">
? Or something different that you created?– brazilianldsjaguar
Sorry the error @brazilianldsjaguar , I am using windowsforms (visual studio). It seems that the question has been edited.
– Bruno
I could post a print of the two forms, and how I would like transitions to occur.
– Edney Batista da Silva