Skip to content
⌘ NSIS Forum Archive

Change button background color

5 posts

r2du-soft#

Change button background color

i try to change button background color:

${NSD_CreateButton} 0 0 42 35 "X"
Pop $BTN_Exit
SetCtlColors $BTN_Exit 0xffffff 0x16617f
Also:

${NSD_CreateButton} 0 0 42 35 "X"
Pop $BTN_Exit
SendMessage $BTN_Exit ${EM_SETBKGNDCOLOR} 0 0xf71661

How can change the button background color?
Anders#
Windows does not support custom button colors, you must use one of the skinning plug-ins.

Also, if you had researched the EM_ messages you would see that they are for edit controls. You can't just assume that a message works for an arbitrary control type.
r2du-soft#
after set the ${WM_CTLCOLORSTATIC} to button style i can change button color but the button text and border hide:

${NSD_AddStyle} $BTN_Exit "${WM_CTLCOLORSTATIC}"
SetCtlColors $BTN_Exit 0x000000 0x555555
also when i use ${ES_MULTILINE} and ${WS_BORDER} before ${WM_CTLCOLORSTATIC} ,i see the button text but i dont see border also i see the radio button...

${NSD_AddStyle} $BTN_Exit "${ES_MULTILINE}|${WS_BORDER}|${WM_CTLCOLORSTATIC}"
SetCtlColors $BTN_Exit 0x000000 0x555555
is possible fix its?
Anders#
Now you are just doing random things. You have to look on MSDN to see which styles you can use, for buttons that means most of the WS_* styles and BS_*.

All of this is pointless though, I already told you, you have to use a plug-in for buttons.
T.Slappy#
Changing button background is a difficult task and it cannot be accomplished with simple WinAPI.

You can use my plugin https://nsis.sourceforge.io/Graphical_Installer or some other 3rd party plugins like https://nsis.sourceforge.io/SkinnedButton_plug-in or https://nsis.sourceforge.io/SkinnedControls_plug-in to change button background.

All these plugins use Picture (Bitmap) as button background so your button can look totally different.