3 posts in this topic
I'm sure this is a simple one to answer and I have searched and experimented before I asked (well enough hopefully!)
I'm trying to set a button background to be white, the font colour red, centred vertically and horizontally and multi-line. Can it be done?
Here is my example code:
#include <Constants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ColorConstantS.au3> #include <FontConstants.au3> #include "ColorConstants.au3" Opt("GUIOnEventMode", 1) $GUI = GUICreate("GUI", 250, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button = GUICtrlCreateButton("Button" & @CRLF & "One", 160, 185, 85, 110, BitOR($BS_MULTILINE, $BS_CENTER, $BS_VCENTER, $WS_EX_WINDOWEDGE)) GUICtrlSetBkColor(-1, $COLOR_White) GUICtrlSetFont($Button, 14, 800, 0, "MV Boli", 5) GUICtrlSetColor($Button, 0xFF0000) GUICtrlSetOnEvent($Button, "_Exit") GUISetState() While 1 Sleep(100) WEnd Func _Exit() Exit EndFunc ;==>_Exit With everything I have tried, this is the closest I get, button white, font red, correct font, but no centring and sometimes no multi-line (depending on button text and font size). I saw I might have to add the default button forced style back in so I did that too $WS_EX_WindowEdge.
Thanks for any help and apologies if I've missed an obvious answer to this elsewhere.