How to get a button to highlight better on Windows 11

RDH 41 Reputation points
2022-08-18T20:08:22.193+00:00

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?

C++
C++
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,527 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,166 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Michael Taylor 48,281 Reputation points
    2022-08-18T20:26:20.383+00:00

    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 39,356 Reputation points
    2022-08-19T15:10:21.167+00:00

    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. https://learn.microsoft.com/en-us/windows/apps/design/style/color

    ----------------------------------------------------------------------------------------------------------------

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

    0 comments No comments

  3. RDH 41 Reputation points
    2022-08-19T15:47:32.853+00:00

    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