Search the Community
Showing results for tags 'gui button text alignment'.
-
I'm trying to change the text color of a button without changing the text alignment, but I must be missing something. Here is my sample script: #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Local $Form1 = GUICreate("button text color test", 250, 250) ;BUTTON 1 WITH NO TEXT COLOR CHANGE Local $button1 = GUICtrlCreateButton("Line 1 of text" & @CRLF & "Line 2 of text" _ & @CRLF & "Line 3 of text", 50, 10, 150, 70, BitOR($BS_MULTILINE,$BS_LEFT)) ;BUTTON 2 WITH TEXT COLOR CHANGE Local $button2 = GUICtrlCreateButton("Line 1 of text" & @CRLF & "Line 2 of text" _ & @CRLF & "Line 3 of text", 50, 100, 150, 70, BitOR($BS_MULTILINE,$BS_LEFT)) GUICtrlSetColor ( $button2, 0xCC0066 ) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "ControlID = " & $Button1, "Button 1 was Pressed!") Case $Button2 MsgBox(0, "ControlID = " & $Button1, "Button 2 was Pressed!") EndSwitch WEnd The top button is formatted the way I want with the text aligned to the left and vertically centered top to bottom in the button, and it contains the shaded button background. The only change made to $button2 is the extra GUICtrlSetColor ( $button2, 0xCC0066 ) below the button. It does change the text color to the desired color, but the vertical formatting and background shading are screwed up. Am I doing something wrong in my code, or is this just what will happen if I try and color text in a button? Any help or advice would be greatly appreciated. Thanks, tbwalker