How to change button text color in NM_CUSTOMDRAW (Win32 API question)

Vinod K Chandran kcvinu82 at gmail.com
Wed Mar 17 00:51:05 UTC 2021


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.





More information about the Digitalmars-d-learn mailing list