# How to change text color on a button with image?

## Recommended Posts

Hi!

I am writing some GUI and i need to use images as buttons, but with text on them (text is from INI file).

Part with button looks like this:

$ankieta1 = GUICtrlCreateButton($txtAnk1, 100,350,765,164)
GUICtrlSetFont(-1, 22, 800, -1, "Arial")
;GUICtrlSetColor(-1,0xffffff)
$hImageBtn_1 = _GUIImageList_Create(765, 164) _GUIImageList_AddBitmap($hImageBtn_1, "c:\path\to\ankieta_clean.bmp")
_GUICtrlButton_SetImageList($ankieta1,$hImageBtn_1, 4)
GUICtrlSetOnEvent(-1, "On_Ankieta1")

The problem - if i uncomment GUICtrlSetColor, color of text changes, but button is just plain gray (no image). How i can change text color not touching image on a button here?

##### Share on other sites

It's been a while but I don't think you can change the text of buttons that use a bitmap. You can add text to the bitmap before you set it to the button, like UEZ does in this topic

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Similar Content

• By Zobu
Hey Guys,
I want to add a new checkbox with its own variable every time the add button is clicked.
The added checkboxes should remain when I close the window or exit the script and when I reopen I should be able to add new checkboxes aswell.
here is what I have so far..
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <GuiButton.au3> $test = GUICreate("adding test", 475, 345, 500, 175)$Check1 = GUICtrlCreateCheckbox("Checkbox 1", 15, 25, 300, 25) $Button = GUICtrlCreateButton("Add", 365, 25, 90, 20)$Check2 = GUICtrlCreateCheckbox("Checkbox 2", 15, 50, 300, 25) $Check3 = GUICtrlCreateCheckbox("Checkbox 3", 15, 75, 300, 25) GUICtrlSetState($Check2, $GUI_HIDE) GUICtrlSetState($Check3, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case$GUI_EVENT_CLOSE ; Exit Case $Button GUICtrlSetPos($Check2, 15, 50, 300, 25) GUICtrlSetState($Check2,$GUI_SHOW) Case $Button GUICtrlSetPos($Check3, 15, 75, 300, 25) GUICtrlSetState($Check3,$GUI_SHOW) EndSwitch WEnd

• Dear members of the forum,
I'm working on a project in which I have to use Image recognition technique.
Due to client restrictions, I couldn't use AutoIt for this project.
Is there a way to use this DLL "ImageSearchDLL.dll" (which is used to do image recognition steps in AutoIt) in VB.Net to achieve the same result?
I have used this DLL few years before and got good results. If there is a latest version of this DLL and if you can share it, that will be helpful too.
Any guidance is deeply appreciated.

• Hello Everyone,
Hoping someone can help me,
I am totally stuck on this problem,

I cannot reach the textarea and the button in a maps page that I get by clicking on a button in a previus page, the only way I can interact with this is using tab and mouseclick but this is a danger method as  you know.

I get the handle by using: $Posizione = _IEAttach("Ricerca Indirizzo su mappa") then I tried a lot of things but nothing works, can someone give me a hint? -------------------- WinWait("Ricerca Indirizzo su mappa") sleep(1000)$Posizione = _IEAttach("Ricerca Indirizzo su mappa")
WinSetState ("Ricerca Indirizzo su mappa", "", @SW_MAXIMIZE  )
WinActivate("Ricerca Indirizzo su mappa")
sleep(500)
;~ $oForm = _IEFormGetObjByName($Posizione, "form1");Punta il Form
$oText = _IEFormElementGetObjByName($Posizione,"indirizzo")
$oText = _IEFormElementGetObjByName($Posizione,"writeAddress")

;~ $LenteTestoMess = _IEFormElementGetValue($oText);Inserisce il PrimoRepertorio nella variabile
;~ _IELinkClickByText($Posizione,$oForm);Clicca su Aggiorna ed invia il form
_IEFormElementSetValue ($oText,"via Ravenna 12" );Completamento campo testo ---------------------------------------------------- Mappa.odt Ricerca Indirizzo su mappa.htm • Hi, i have an AutoIT script that sends emails with two embedded images. When users get the email they don't see the images. How should I fix my code? Thank you for your support, Amos Func fSendMail()$TemplateName = StringRegExpReplace($Template, "^.*\\|\..*$", "") $SmtpServer = "smtp.**.com"$FromName = "do-not-reply@*********" $FromAddress = "do-not-reply@******"$ToAddress = $MG1_Mgr & ";"&$Owner $Subject = "ACTION REQUIRED - " &$TemplateName $Body =$sBody5 $IPPort = 25$ssl = 0 Global $oMyRet[2] Global$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = fINetSmtpMailCom($SmtpServer, $FromName,$FromAddress, $ToAddress,$Subject, $Body,$IPPort, $ssl) If @error Then MyErrFunc() EndIf EndFunc;fSendMail Func fINetSmtpMailCom($s_SmtpServer, $s_FromName,$s_FromAddress, $s_ToAddress,$s_Subject = "", $as_Body = "",$IPPort = 25, $ssl = 0) Local$objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' &$s_FromName & '" <' & $s_FromAddress & '>'$objEmail.To = $s_ToAddress Local$i_Error = 0 Local $i_Error_desciption = ""$objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then$objEmail.HTMLBody = $as_Body Else$objEmail.Textbody = $as_Body & @CRLF EndIf$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =$s_SmtpServer If Number($IPPort) = 0 Then$IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =$IPPort $objEmail.Configuration.Fields.Update$objEmail.Fields.Update ;$objEmail.Send **************** If @error Then MyErrFunc() EndIf$objEmail = "" EndFunc;fINetSmtpMailCom

• hello evrybody
here is an example about how to split your texts using a delimiter with the ability to select how much of delimiters shows in each colum  with $i_number e.g you have a long text and you want to split it in an array that evry colum have a number (n) of lines i made a function that do that for you just call it with a three params$s_text
$i_number the number that you want to put in each col$s_siparator
the siparator
default is "|"
here is the function with example
i hope that it will be useful for you

****

#include <Array.au3> $s_txt = "some text1some text2|some text3|some text4|some text5|some text6"$array = splitText($s_txt, 2) _ArrayDisplay($array) Func splitText($s_text,$i_number, $s_siparator = "|") Local$a_TXT = StringSplit($s_text,$s_siparator) Local $a_Return[$a_TXT[0] + 1] If ($a_TXT[0] <=$i_number) Or ($i_number <= 0) Then ReDim$a_Return[2] $a_Return[0] = 1$a_Return[1] = $s_text Return$a_Return EndIf Local $i_Processed = 1,$i_arrayProcessed = 1 Do For $i =$i_Processed To ($i_Processed +$i_number) - 1 If ($a_TXT[0] <$i) Then ExitLoop If Not ($a_Return[$i_arrayProcessed]) Then $a_Return[$i_arrayProcessed] = $a_TXT[$i] Else $a_Return[$i_arrayProcessed] &= $s_siparator &$a_TXT[$i] EndIf$i_Processed += 1 Next $i_arrayProcessed += 1 Until ($a_TXT[0] < $i_Processed) ReDim$a_Return[$i_arrayProcessed]$a_Return[0] = $i_arrayProcessed - 1 Return$a_Return EndFunc ;==>splitText
accept my greetings
thanks to
@Dan_555
for his notes

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...