I'd like to know, how do I change the contents of Form without having to open another, when I click on Encryption for example, the content changes without having to open another Form. How do I do this?
By manipulating UserControl
(s) you can create an object inherited from Control
. So, create your form in this UserControl
and make it work as a Form.
After this, create a% client_config that will display the pages, and declare the controls as in the example below:
public UserControlHome ucHome = new UserControlHome();
public UserControlCripto ucCripto = new UserControlCripto();
And create this method to change the Panel
that is in Control
client Panel
:
public void AlterarConteudo(ref Control controle) {
// considere 'conteudo' o Panel que irá ter os controles dentro
conteudo.Controls.Clear(); // - remove os controles dentro do Panel
{ // altera propriedades do controle que irá ser colocado
controle.Dock = DockStyle.Fill;
}
// adiciona o controle ao cliente
conteudo.Controls.Add(controle);
}
And when you click on the Encryption button, call the method with the expression:
AlterarConteudo(ref ucCripto);
And for the Home button:
AlterarConteudo(ref ucHome);
Remember to implement a method to save information in controls by being discarded .