# 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

Register a new account

• ### Similar Content

• By therks
So I don't have any code cooked up yet as this is still in the theoretical stage. Just looking for some advice.
My current idea is to resize the image to 1x1 pixel, probably using _GDIPlus_ImageResize, and read the color of the resulting pixel to obtain an admittedly very general sense of brightness. Does anyone think this could work?
We have a CCTV system running at home using some home made cameras (raspberry pi) and we're trying to automate toggling settings for day/night time. We started with an AutoIt script that checked sunrise and sundown times for our location (calculations pulled from here) and toggled the settings based on that. Unfortunately our weather varies wildly, so it can get light/dark far outside normal sunrise/sundown times. Now we're hoping to periodically grab a still from the camera and toggle the light mode based on that.

• hello autoit group
i had make a function that put some thing into the clipBoard and paste it
using the send function
e.g
ClipPut("hello")
send("^v")

when the keyboard is english all things work fine
but when the keyboard is arabic the send command write the ltr v insted of the text in clipboard
i was tryed to use
send("{ctrldown}v{ctrlUp}")
but the same
please can any one help me

• By Kiko745
Hello!
I am new to autoit so please if someone could help me. I am trying to combine multiple .txt files but I can't get it right. In every file are the exact amout of lines ( for example here are 2 ) ,            I don't want to make it for just 2 lines for each txt files but for all the lines the txt files contains. The thing I want to do is :
Text File 1
Hello my name
I am a big
...
Text File 2
is Fred,
...
Text File 3
and I like to eat pizza.
Not getting this right.
...
------------------- Combine them all into one txt file like here ------------------------------
Final Text file
Hello my name is Fred, and I like to eat pizza.
I am a big Potato head for Not getting this right.
...

P.S. Sorry for my English, not my first language.

• By Kruxe
Hello Everyone,
I am very green when it comes to AutoIT, I have recently started using it to automate a job that i perform using MS Excel and that is working great. Recently I have been faced with a challenge I which i need to copy a specific set of lines from one .txt file and past them, overwriting a specific set of lines in a different .txt file. I honestly have no clue how I can copy the specified lines and transfer them. What functions / commands could I use and how could I lay them out I AutoIT? Any and all help will be appreciated.
Thanks!
Kruxe
×

• Wiki

• Back

• #### Beta

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