Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make the WinForms Tab Control be able to do tab reordering like IE or Firefox?

Is it possible to reorder the tabs in the WinForms TabControl at run-time like IE or Firefox?

Links like this don't give me much hope.

like image 350
KevinDeus Avatar asked Dec 04 '10 09:12

KevinDeus


People also ask

How do I change the tab order in Winforms?

Tab order can be set in the Properties window of the designer using the TabIndex property. The TabIndex property of a control determines where it's positioned in the tab order. By default, the first control added to the designer has a TabIndex value of 0, the second has a TabIndex of 1, and so on.

How do I create a tab control in Windows form?

Adding a TabControl to Form I create a Windows Form application using Visual Studio . NET and add a TabControl from Toolbox to the Form by dragging the TabControl to the Form. After that I resize and reposition TabControl according to the Form size. The Form Designer adds the code for TabControl for you.


1 Answers

Sure, it's possible! You're most likely trying to overcomplicate the solution. Essentially, all you have to do is subclass the standard TabControl and add some logic to the mouse event handlers. You'll just need to check which form the user is currently dragging and reorder it in the TabPages collection.

There are a couple of complete solutions available online:

  • Reordering TabPages inside TabControl
  • Drag and Drop Tab Control
  • Reposition TabItems at runtime
like image 77
Cody Gray Avatar answered Nov 02 '22 09:11

Cody Gray