Solved

Any way to change background color of a readonly CEdit?

Posted on 2001-08-23
6
401 Views
Last Modified: 2013-11-20
Is there Any way to change background color or textcolor of a readonly CEdit?
0
Comment
Question by:JensHell
6 Comments
 
LVL 2

Expert Comment

by:VCStud
ID: 6417139
Hi,

It might be possible to do that in WM_CTLCOLORSTATIC message. That is the message your read only CEdit would send while it is being painted.

Cheers,
VCStud
0
 
LVL 4

Expert Comment

by:jtwine100697
ID: 6417518
You actually have do to a little more than that.  You have to correctly handle background painting as well.  For further reference, check out: http://www.codeproject.com/editctrl/enhfocusedit.asp.  That is an older version of my focus-edit control, with additional filtering of keystrokes and pasted text.  But it should give you the information you need to handle painting of the control's background.

-=- James.
0
 
LVL 4

Expert Comment

by:jtwine100697
ID: 6417521
Note that the code on this site that processes links is a bit broken, and will include the ending period in the link.  Remove it, or try this one: "http://www.codeproject.com/editctrl/enhfocusedit.asp"

-=- James.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 42

Accepted Solution

by:
sedgwick earned 25 total points
ID: 6418374
there's a sample in: http://codeguru.com/editctrl/ColorWeir.html

good luck
0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 25 total points
ID: 6419522
The link provided by sedgwick looks good, and very simple to implement.  But the code there needs this line:

 switch (nCtlColor)
 {
  case CTLCOLOR_EDIT:  
  case CTLCOLOR_MSGBOX:  
  case CTLCOLOR_STATIC:  //<<<--- add this
   switch (pWnd->GetDlgCtrlID())  
   {    

of else it might have no effect on a read-only edit control.

-- Dan
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9528424
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: sedgwick, DanRollins (points to be split)

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 55
windows 10 how make picture as desktop background 2 58
while loop over for loop 7 93
has22 challenge 11 80
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now