How do I create tabs using .NET?

Tabbed windows allow users to drag tabs to reorder their orders or pull them out of the tab bar to turn them into stand-alone windows. They are so common nowadays. A lot of the apps I use have these (e.g. IE, Firefox, Chrome, VS, Android Studio, etc.)

I'm looking for a .NET Framework or control library that helps in creating tabbed windows. I've tried some searches on stackoverflow and google but there is very little about it. One of them led me to this

http://fabtab.codeplex.com/

There is nothing from the .NET API that can help me with this problem, so do I have to build it from scratch or use a third party library?

Guys, please give me some suggestions or share your experience with me. I can use .NET WinForm or WPF, but if it's a different framework I'll be willing to accept it.

+3


source to share


1 answer


In Windows application, you can create two types of applications

  • Multi-format applications
  • Single format applications

In a multiple form application, you have one main form that contains child forms and you can display them as pinned tabs using a tab control.

// to add a form in the MdiParent form
     var form = new ChildForm();
    form.MdiParent = this;
    form.Show();

      

In a single form application, forms are created but not tied to the main form

 // to add a form in single form application
    var form = new AnotherForm();
    form.Show(); //  form.ShowDialog() should not be used because it will be modal form

      



to achieve what you want you need to handle drag and drop events for the tab and main form

if you've dragged and dragged a shape outside of the main shape and dropped it inside, you can easily attach that shape to the main shape by doing form.MdiParent = this; // this is the main form

and if you dragged the form from the tab to the outer main form you will format the form from the main form

from.MdiParent = null;

      

hope this helps you

+3


source







All Articles