![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
How do I change the background color of an entire edit control box, not just the...Hello All!
How do I change the background color of an entire edit control box, not just the background color of its text? Thanks in advance, Steph |
|||
|
#2
|
||||
|
||||
MOVED: change the background color of an entire edit control boxstart with this article: http://support.microsoft.com/kb/q117778/
and let me know how it goes. It's been some time since I've played with specifically coloring controls. basically, from the article, 1. override the WM_CTLCOLOR and WM_DESTROY messages 2. add a CBrush* member variable to the dialog class (that has the edit control) [see the article] 3. copy the code to the functions created for the messages 4. comment-out the SetTextColor() call (unless you want a change) 5. set a color in the class constructor [set (255, 255, 0) for yellow] 6. set the same color in SetBkColor() function. That's about the basics of it, I believe. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! Last edited by cable_guy_67 : 03-Jun-2006 at 09:16.
Reason: Edited old title
|
|
#3
|
|||
|
|||
MOVED: change the background color of an entire edit control boxTurboPT,
Well, I did that, and it looks fine. However, if the user clicks the edit boxes or uses the tab key many times, my program stops running. I thought it could have something to do with deleting the brushes (lack of memory or something). But, I deleted the brushes in the DESTROY function, as the website said to. Do you think it could be becuase I initialized the brushes at the beginning of the CTLCOLOR function? Also, I added two new dialog windows to my program (so I had to add two new classes for them). Basically, when a specific button on the first dialog window is pressed, the second dialog window is supposed to appear (to do this I also had to add a member variable to my first (original) class, with its data type being the class name of my second dialog). Now, this worked. However, when I did the same thing for when a specific button button on the second dialog window is pressed (meaning the third dialog window is supposed to appear), the third dialog window does not display (it somewhat flashes when the specific button on the second dialog is pressed constantly). Do you have any ideas? Thanks Again, Steph Last edited by cable_guy_67 : 03-Jun-2006 at 09:16.
Reason: Edited old title
|
|
#4
|
|||
|
|||
MOVED: change the background color of an entire edit control boxTurboPT,
Regarding my last message, I figured out the problem that I mentioned in the second paragraph. So, thanks anyways. However, I do still need help with what I wrote in the first paragraph. Thanks, Steph Last edited by cable_guy_67 : 03-Jun-2006 at 09:17.
Reason: Edited old title
|
|
#5
|
||||
|
||||
MOVED: change the background color of an entire edit control boxMaybe, the brush in the article is created once, in the constructor.
See if making such a change helps that problem. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! Last edited by cable_guy_67 : 03-Jun-2006 at 09:17.
Reason: Edited old title
|
|
#6
|
||||
|
||||
MOVED: change the background color of an entire edit control boxWhat's the latest on those brushes?
If you still have trouble, post your code (if you can) and we'll try and see what's happening. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! Last edited by cable_guy_67 : 03-Jun-2006 at 09:18.
Reason: Edited old title
|
|
#7
|
|||
|
|||
MOVED: change the background color of an entire edit control boxTurboPT,
Sorry that I did not reply sooner....I have been so busy lately, that I did not get a chance to work on it until today. But your suggestion did work. I did have to place it in the constructor. Thank you (again). I really do appreciate all your help. Until Next Time, Steph Last edited by cable_guy_67 : 03-Jun-2006 at 09:18.
Reason: Edited old title
|
|
#8
|
|||
|
|||
MOVED: change the background color of an entire edit control boxTurboPT,
I wrote a message with the subject "Accessing values from a different dialog" (in the "MS Visual C++ / MFC Forum"). 20 people have read it, but no one has responded. Could you take a look please? Thanks, Steph Last edited by cable_guy_67 : 03-Jun-2006 at 09:19.
Reason: Edited old title
|
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| change dlg background | inbal79 | MS Visual C++ / MFC Forum | 3 | 19-Mar-2006 06:49 |
| [winapi] edit control is lying to me... | ubergeek | C Programming Language | 8 | 15-May-2005 18:02 |
| Can you change the background colors in a console app? | swashplate | C++ Forum | 3 | 07-Dec-2004 20:19 |
| Help! Some basal questions about MFC | xutingnjupt | MS Visual C++ / MFC Forum | 1 | 05-Dec-2004 03:38 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The