|
-
November 1st, 2005, 06:18 AM
#1
Changing Text Color in a Button
Hi everyone,
I have a button anda text and a window handler to it, now how do I change its text's color?
Thanks in advance.
-
November 1st, 2005, 08:47 AM
#2
Re: Changing Text Color in a Button
Handle the WM_CTLCOLOR message.
-
November 4th, 2005, 07:18 AM
#3
Re: Changing Text Color in a Button
I am not sure, but I think the message at the win32 level is WM_CTLCOLORxxx where xxx stands for a bunch of different items. I have always thought the only way you could color the text of a button is via an owner draw operation (at least at API level 4). In any case, the WM_CTLCOLORBTN for setting the button color does not work; its a bogus message (it is sent but it is useless). Its either the control panel or a full owner draw.
However, I have been able to use these color messages to set the text color of static windows, edit boxes and the background color of dialog and edit boxes. However, the color of the text in a disabled edit control I have not been able to set using these messages (I have to cheat by making the edit box read only). Be careful when you handle these messages. You set text and background for the same control in different messages depending upon their status (enabled, disabled). Some controls you can't do anything with (colorwise) unless you do a full owner draw.
Controlling Windows colors is a pain and not very consistent. Let me know how you make out in your attempts!
Brian
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|