3

im currently overiding the WM_NCPAINT, WM_NCCALCSIZE and WM_NCACTIVATE to paint my own color/themed title bar for an application im working on. Now this is working great however the min, max and close buttons still are xp default theme.

I looked into what controls them and the mouse messages do. However they also contol resizing and other functions that I dont want to lose.

Is there an easy way to just change the theme of these buttons?

  • Windows XP
  • MFC Forms
  • Visual studio 2005
Danubian Sailor
  • 1
  • 38
  • 145
  • 223
Lodle
  • 31,277
  • 19
  • 64
  • 91
  • Programs that arrogantly override my chosen GUI appearance are one of my pet hates in life. Just don't do it. Leave the user's max, min and close buttons looking like the user chose them to look! – David Arno Oct 05 '08 at 08:36
  • What if this is part of a application that has customisable skins? Who said anything about the user having no say in anything? – Matthew Scharley Oct 05 '08 at 09:03

3 Answers3

2

I think your best bet here is to disable the buttons and redraw them with something akin to to the code I posted in this answer. It's in C# with WinForms, but the vast majority of it is overloaded WndProc() anyway, which you should be able to use almost copy/paste into MFC.

Implementing click handlers to do what you want them to do is trivial.

Note: The asker of that question said the code didn't work in Vista. I don't have a Vista box, but it works for me in XP.

Community
  • 1
  • 1
Matthew Scharley
  • 127,823
  • 52
  • 194
  • 222
0

This also helped: http://www.catch22.net/tuts/titlebar

Lodle
  • 31,277
  • 19
  • 64
  • 91
0

You can also check out how it's done in MFC Next (VS2008 SP1). The theming support there does custom draw of the whole title bar, you can get a few ideas from that. I presume they tested it on Vista, too ;)

Roel
  • 19,338
  • 6
  • 61
  • 90