views:

69

answers:

1

Can someone tell me how to create tabs in the title bar area of a C# Winforms application? I'm looking for something similar to how Google Chrome looks. Each tab in Chrome is docked in the title bar of the main application window.

+1  A: 

Try setting FormBorderStyle of your form to None. I think if you look around there are some articles on how to build a UI like this where you can still have the drag functionality you'd lose by hiding the title bar. Then you could build up the title bar area the way you wanted it to work.

Wil P
This is a viable option, however, I don't think Chrome uses this technique. In Chrome, you still get the standard "minimize", "Maximize" and "Restore" buttons plus you still get the Aero Glass effect on the title bar.
icemanind
I wonder if they are just creating the behavior of Minimize, Maximize, Restore, with their own control? Honestly I don't know, but I would suspect it's what they are doing. Here is an example of someone who designed a customized title bar... http://www.dreamincode.net/forums/topic/64981-designing-a-custom-title-bar/
Wil P
@icemanind Chrome also doesn't use windows forms. Windows forms limits some of the things you can do in exchange for behind able to do those things _much_ more easily.
Joel Coehoorn
@Joel What do they use? WPF?
icemanind
@icemanind I believe they use the win32 api directly from C++
Joel Coehoorn
Win32 API allow for you to draw anything you want in the titlebar (actually so did the win16 api ;-)
FastAl
... by handling the WM_NC* family of Window messages. That can be done in managed code too by overriding WndProc, but it's not exactly straight forward.
Mattias S
They may have, but in windows forms, a borderless form would definitely be your best bet to duplicate this kind of functionality. Just make it borderless and then create a custom Titlebar control that has tabs and whatnot. You can also build in the minimize/maximize/close buttons with very little difficulty -- except that of creating the actual graphics, of course.
Joshua Evensen