Solved

Any way to change background color of a readonly CEdit?

Posted on 2001-08-23
6
387 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 42

Accepted Solution

by:
sedgwick earned 25 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

11 Experts available now in Live!

Get 1:1 Help Now