Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The exact layout and the controls you need will be up to you.This is meant as an simplistic starting point to make you see the options you have(here of course 1 option is provided):</p> <blockquote> <p>1) add splitcontainer to the form.</p> <p>2) add flowLayoutPanel to left panel of splitcontainer and dock in parent container</p> <p>3) since you asked for vertical layout set FlowDirection on the flowLayoutPanel to topdown</p> <p>4) in my example i used 6 buttons and named them(instead could be their text) btncontrol1,2,3...so on, do the same.</p> <p>5) set all buttons click handler to the same(in this case buttons_Click)</p> <p>6) copy this code and paste</p> </blockquote> <pre><code> public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void buttons_Click(object sender, EventArgs e) { Button b = sender as Button; switch (b.Name) { //of course after each ClearPanel what i do is only for //demonstration. case "btnControl1": splitContainer1.Panel2.SuspendLayout(); ClearPanel(); splitContainer1.Panel2.Controls.Add(new ListBox()); splitContainer1.Panel2.ResumeLayout(); break; case "btnControl2": splitContainer1.Panel2.SuspendLayout(); ClearPanel(); splitContainer1.Panel2.Controls.Add(new RadioButton()); splitContainer1.Panel2.ResumeLayout(); break; case "btnControl3": splitContainer1.Panel2.SuspendLayout(); ClearPanel(); splitContainer1.Panel2.Controls.Add(new Button()); splitContainer1.Panel2.ResumeLayout(); break; case "btnControl4": splitContainer1.Panel2.SuspendLayout(); ClearPanel(); splitContainer1.Panel2.Controls.Add(new DateTimePicker()); splitContainer1.Panel2.ResumeLayout(); break; case "btnControl5": splitContainer1.Panel2.SuspendLayout(); ClearPanel(); splitContainer1.Panel2.Controls.Add(new DataGridView()); splitContainer1.Panel2.ResumeLayout(); break; case "btnControl6": splitContainer1.Panel2.SuspendLayout(); ClearPanel(); splitContainer1.Panel2.Controls.Add(new TextBox()); splitContainer1.Panel2.ResumeLayout(); break; default: break; } } private void ClearPanel() { if (splitContainer1.Panel2.HasChildren) { foreach (Control c in splitContainer1.Panel2.Controls) { c.Dispose(); } splitContainer1.Panel2.Controls.Clear(); } } } </code></pre> <p>Hope it help you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload