March 17, 2021
On Wednesday, 17 March 2021 at 00:51:05 UTC, Vinod K Chandran wrote:
> On Tuesday, 16 March 2021 at 19:42:26 UTC, Imperatorn wrote:
>
>>
>
> At last, i found the answer myself. There is a  item called dwDrawStage in NMCUSTOMDRAW structure. If  value of dwDrawStage is equal to CDDS_PREERASE, call SetBkMode with transparent and call SetTextColor. Then draw text  with DrawText function. And finally, return CDRF_NOTIFYPOSTPAINT.  In short, do the color changing process in pre-erase stage and return CDRF_NOTIFYPOSTPAINT constant. As per MSDN, What this constant means  is,
>>>> The control will notify the parent after painting an item. This occurs when the dwDrawStage of the NMCUSTOMDRAW structure equals CDDS_PREPAINT.

Good that you solved it, that wasn't what I thought the solution would be 👀

Was more than 10 years ago since I was "the king of win api" 😔
March 17, 2021
On Wednesday, 17 March 2021 at 06:39:26 UTC, Imperatorn wrote:
>
> Good that you solved it, that wasn't what I thought the solution would be 👀

I was sure about i can solve this through NM_CUSTOMDRAW. Because, in VB .net, we can change back color & fore color of button. On the same time, there is an option to turn on the OwnerDrawStyle. If we set this property true, we need to draw the button on our own. So i am pretty sure that, that property will turn a normal button to an owner drawn button. But if we don't use that property, then also we can change the button colors. So that means, without using BS_OWNERDRAW style, we can change the colors. And that's the NM_CUSTOMDRAW message. Unfortunately, there is not much tutorials or documentation about handling this message in a Button's case. We can find some examples and articles related to ListView & Treeview. But not a single line of documentation about buttons.

>
> Was more than 10 years ago since I was "the king of win api" 😔
Glad to know that. Can you write an article about how to use Gdi+ in win api apps ? Now I am using gdi. But i want to test how gdi+ works on win32 apps.

1 2
Next ›   Last »