Search code examples
c#winformspinvoketoolbar

Make ToolBar look like Windows Vista/7 instead of classic


I want to make my application look more like a native app than a .NET app and I use .NET because of Visual Designer and C#.

I've seen some native apps using a toolbar that looks very similar to Vista/7 menus.

Check out the example:

Windows Vista/7 style

Some native apps like Notepad++, Codeblocks, etc. uses the same Vista/7 style for toolbars. How can I do the same in C#? I know P/Invoke, so, I need to know the methods to be used or an example.

I don't use ToolBarStrip, I use ToolBar because of the nativeness. What P/Invoke can I use for make the Toolbar look like the above image (Vista/7 look)?

EDIT: Based on this question, I need to do the same in P/Invoke instead of Win32.


Solution

  • Notepad++ uses both versions of the native toolbar controls in its source code. I'd assume it chooses between the two based on the Windows version. You already tried the .NET wrapper for the legacy one (ToolBar class) so that's probably not the one you like.

    The other one is the more recent Rebar control, also known as "Coolbar". Beware that its look-and-feel depends on the Windows version so don't go off the (dated) screenshots in the linked MSDN article. There is no official .NET wrapper for it, but programmers has written some. There is a Codeproject.com project that proposes one, I don't normally recommend any such projects but you sound quite capable of getting the bugs out.