Owner Drawn button focus

I am trying to mimic a standard button by drawing my own owner drawn button. When a standard button is in focus, the focus rectangle is black and is every other pixel. I'm not sure this can be changed in a standard button. In my owner drawn button, I changed the text color to Orange, but the focus rectangle (DrawFocusRect) is blue and is every pixel. It there a way to change that to black and every other pixel like the standard focus rectangle? I can't find any structures that deal with that. Any help here? Thanks.

Sutton
Last edited on
IIRC the focus rectangle is always drawn by taking the bit-wise complement of the pixel's color data. See the mention of XOR in the docs
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-drawfocusrect

This explains how orange (bits 0xff8000) is transformed into blue (0x007fff).
Last edited on
Yes. I saw that doc. You answered my question in that it must not be able to be overridden. That is one of the non-customable items on an OD Button.
Is it possible to modify the color of the pixels that determine the color of the focus rectangle only while the button is focused?
Brilliant. That worked. Thanks!!
Topic archived. No new replies allowed.