Old 9th March 2019, 19:14   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 342
Change button background color

i try to change button background color:

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

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

How can change the button background color?
r2du-soft is offline   Reply With Quote
Old 9th March 2019, 20:05   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,197
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 12th March 2019, 12:12   #3
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 342
after set the ${WM_CTLCOLORSTATIC} to button style i can change button color but the button text and border hide:

HTML Code:
${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...

HTML Code:
${NSD_AddStyle} $BTN_Exit "${ES_MULTILINE}|${WS_BORDER}|${WM_CTLCOLORSTATIC}"
SetCtlColors $BTN_Exit 0x000000 0x555555
is possible fix its?
r2du-soft is offline   Reply With Quote
Old 12th March 2019, 13:27   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,197
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 1st April 2019, 08:22   #5
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 540
Send a message via ICQ to 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.

Cool looking installers with custom design: www.graphical-installer.com
Design NSIS setup Pages easily: www.install-designer.com
Build NSIS installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.3 Rio: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump