How to get a button to highlight better on Windows 11

RDH 41 Reputation points

We are a MFC desktop app. Customers are complaining that pressed/pushed button states are nearly indistinguishable from non pressed/pushed button states. On my Windows 10 box, when a button is pushed, the background of the button is a nice easy to see blue color. But, on Windows 11, it barely changes from (253,252,253) to (249,249,249).

In our app, I stepped thru code until I found the button background is displayed in uxtheme::DrawThemeBackground with BP_PUSHBUTTON as the part ID and a state ID of PBS_PRESSED.

I created a stock MFC desktop app and added a button to the AboutDlg and ran it on both my Win10 and Win11 box and I see the same thing with it.

I searched around for a way to change the color theme on the Win11 box but didn't find a setting that helped. I did run Paint and found that pressed buttons in Paint seem to at least have an outline drawn on them.

How do I get a simple MFC app to draw a pressed button so that a user can easily tell it is pressed? Is there some theme setting on Win11 user's should be using?

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,329 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,822 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Michael Taylor 41,816 Reputation points

    MFC, like all Windows apps, follow the Windows theme. Honestly this is a Win11 theme problem and not something I think your app should work around. You might change the color for the default theme but what happens if the end user is using a custom theme or high contrast or something else? Your app may then look odd.

    Personally I think the solution is that you should provide some other indication of a pressed state (for stateful buttons). For the user pressing a button I don't know that it would be a big deal. Do the users honestly get confused when they mouse click on a button and it temporarily changes styling?

    But if you really, really want to change the color of the button then you'll have to react to the button clicked event. It has been a really long time since I've had to work with MFC so I found a relatively recent MFC post here on how to do it.

  2. Limitless Technology 38,881 Reputation points

    Hello there,

    Did you change colour in you image during deployment?

    The CMFCButton class adds functionality to the CButton class such as aligning button text, combining button text and an image, selecting a cursor, and specifying a tool tip.


    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

  3. RDH 41 Reputation points

    Hi Limitless,

    Odd it is. No "Reply" link under your post but there is under the other posts. So, I just reply here. I am quite familiar with MFC. And in the past we used to draw everything. I don't want to go back to the Win 3.2 days. And, we now build on a toolkit that is built on MFC. It is doing the background drawing using uxtheme APIs which have worked well for a long, long time. We display our PNG images are on top of the button after using theme APIs. We don't put text on buttons for reasons I have already cited.

    Why did Microsoft all of a sudden go so bland. I guess color is more expensive than it used to be. I mean really, a tiny change in intensity to show a pressed state is considered as being a modern UI? What was Microsoft thinking?

    0 comments No comments