Home > Software design >  .NET C# Using TreeView in WinForms like tab control
.NET C# Using TreeView in WinForms like tab control

Time:06-12

I want to use TreeView in my software so when user clicks a node, the content of the Form will be changed. Example in this picture, but also I want to grab user input from all forms.

enter image description here

private void Form1_Load(object sender, EventArgs e) {
  tabControl1.Appearance = TabAppearance.FlatButtons;
  tabControl1.ItemSize = new Size(0, 1);
  tabControl1.SizeMode = TabSizeMode.Fixed;
}

private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) {
  if (e.Node.Name == "TabPage1") {
    tabControl1.SelectTab("TabPage1");
  }
  else {
    tabControl1.SelectTab("TabPage2");
  }
}
  • Related