-
February 24th, 2004, 04:24 AM
#1
Edit Box?????or Static text control
How can i make the background color of static text box to white................
or
why when i set my edit text box property to read only.its background color changes to windows color.....and not remains white
please help me...........
thanks
Vishal
-
February 24th, 2004, 04:26 AM
#2
Re: Edit Box?????or Static text control
Originally posted by VishalNikiSharma
why when i set my edit text box property to read only.its background color changes to windows color.....and not remains white
To indicate that the control is read-only. That's by design, and users expect it to be like that.
-
February 24th, 2004, 04:42 AM
#3
Search the forum for the how-to. Doing this with Static Controls, and with Edit Controls, has been asked previously. You should be able to find the answer you are looking for including examples.
Search for CStatic color or CEdit color, and you should get lots of relevant hits.
-
February 24th, 2004, 06:29 AM
#4
If u r using MFC derive a class from CEdit and override the WM_CHAR message handler. so that whenever there is some keypress the msg is not forwarded. To the control. So ur control will be readonly AWA with whitebackground. or u can try to create user drawn controls.
"I came"
"I saw"
"I conquered"
-
February 24th, 2004, 07:10 AM
#5
Originally posted by Cyber Bandit
If u r using MFC derive a class from CEdit and override the WM_CHAR message handler. so that whenever there is some keypress the msg is not forwarded. To the control. So ur control will be readonly AWA with whitebackground. or u can try to create user drawn controls.
Sorry but that is not necessary and definitely not the right way to do it.
-
February 24th, 2004, 07:15 AM
#6
Re: Edit Box?????or Static text control
Originally posted by VishalNikiSharma
How can i make the background color of static text box to white................
or
why when i set my edit text box property to read only.its background color changes to windows color.....and not remains white
Well...although I agree with gstercken not to change the default windows behaviour, you can change it by writing your own edit control derived from 'CEdit'.
React on the 'WM_CTLCOLOR_REFLECT' message. Inside the handler 'CtlColor()' you can check whether the field is read-only...
Code:
if((GetStyle() & ES_READONLY) == ES_READONLY)
{
// Edit field is read only
}
-
February 24th, 2004, 08:02 AM
#7
Originally posted by Andreas Masur
Sorry but that is not necessary and definitely not the right way to do it.
Hey andreas can u explain why the path which suggested that is overriding the WM_CHAR not the right way.
"I came"
"I saw"
"I conquered"
-
February 24th, 2004, 12:22 PM
#8
Originally posted by Cyber Bandit
Hey andreas can u explain why the path which suggested that is overriding the WM_CHAR not the right way.
Simply, because you are trying to solve problem A by using a workaround which is usually be used for a problem B.
In other words you eliminate a standard procedure for solving a problem which is not related to this procedure at all.
-
February 27th, 2004, 12:12 AM
#9
Hi
I am not using mfc.i am using atl .............
vishal
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
|