How to create a dynamic panel that will be displayed and hide the use of selections in the combo box in C #?

I want to make a GUI that is dynamic, which means that the GUI will change depending on the choices the user makes in the combo box.

For example, if the combo box consists of {English, Spanish, French}, the panel at the bottom of the combo box will change its description language depending on the choice.

To do this, I believe that I need to do something like a transparent panel, and then redraw the panel, but I have no idea how to do this.

Can someone tell me how this happened in Visual Studio 2005 C #?

Thanks in advance.

+4
source share
1 answer

I have this exact implementation right here: http://nbug.codeplex.com/SourceControl/changeset/view/6081#107027 , which implements the IPanelLoader interface (ISubmitPanel for my case) and loads any panel using the same name in combo box. Basically download the source code and compile it and look at the Configurator project. There are many things that will require me to explain pages, but there is already a complete example.

In my case, any form that implements the ISubmitPanel interface (MailForm, FtpForm, etc. in my case) can be loaded as follows:

 private void SubmitComboBox_SelectedIndexChanged(object sender, EventArgs e) { switch (this.submitComboBox.SelectedItem.ToString()) { case "E-Mail": this.Controls.Add(new MailForm()); break; case "FTP": this.Controls.Add(new FtpForm()); break; case "HTTP": this.Controls.Add(new HttpForm()); break; } } 

Of course, this code should work in a different form, where you want to load another form.

Dropdown to load panels

E-Mail panel loaded

Edit: Source code is NBug project.

+4
source

All Articles