I want to set color & back color in a text box ? What API should i use ? Was it possible ?
Does it exist an alternative to a textbox, where i could change colors ??
Thanks a lot ;);)
++
Kheo,
look up a message WM_CTLCOLOREDIT for the place to set the edit colors, you need to set 3 things, the edit back color, the text for and the text back colour, its a bit messy but works OK when u get it going.
Regards,
hutch@pbq.com.au
Check my Pipe tutorial. It demonstrates how to change the text and background color of an edit control
Ok, thanks a lot, i'll go to see that..
Oh sorry for my poor english ;(
But thanks, i save my life ;)
/ Kheo /
Sorry, but it's me again !
I explain u what i've made ! I'm creating a dialogbox with the API DialogBoxParamA associated to an .RES file that contain my dialog form. I've added the comparaison to WM_CTLCOLOREDIT message but it seen not work, coz when i trace my soft with Sice, it never goes in the code section associated if this message was send.... Could u help me again?
/ Kheo /
The WM_CTLCOLOREDIT only works when my text box was enable ? Because i put it with a ready only flag, making it not modifiable...
To which value correspond Yellow color etc .. and BLACK_BRUSH ??
I'm coding in tasm ...
thanks ;)
++
Hi,
Kheo
;===================================
; Set color for edit boxes
;===================================
.if uMsg==WM_CTLCOLOREDIT ; = 133
;edit_boxes_handle dd 0
mov eax ,edit_boxes_handle
cmp eax,lParam
jne not_now
call SetTextColor,wParam,00FF0000h ; Blue
call SetBkMode,wParam,1 ; 1 = TRANSPARENT or 2 = OPAQUE
call SetBkColor,wParam, 00000000h ; Black SetBkMode
call CreateSolidBrush, 0000FFFFh ; Yellow brush color value
call SelectObject,wParam,eax ; With brush handle
ret
not_now:
forge
Was it really possible ? it doesn't work ...
I don't understand what i could forget ?
As there is someone that could make me an example with a res file ?
Please .....
thanks ++
When you disable a window, it is disabled, and colours itself with the default colours. It is also the same if you want you editbox to be readonly, you have no choice becasue the colour is always set to gray.
However, if you start looking at rechedit controls, you will find that they are much easyier to use than edit controls, in almst all aspects. If you want to create a richedit control in a dialogbox, create it using a custom control....
CONTROL "Some Text",100,"RichEdit",ES_MULTILINE,10,10,100,100,WS_EX_CLIENTEDGE
Hi,
Kheo
;==================================================
; Set color for edit boxes read only or read/write
;==================================================
You will find documented example and source at:
http://www.fhills.hotkey.net.au/~forge/tempedit.zip
6253 bytes
Hope this will help.
forge
This message was edited by forge, on 1/30/2001 5:25:48 AM