?
Solved

Any way to change background color of a readonly CEdit?

Posted on 2001-08-23
6
Medium Priority
?
459 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 100 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 100 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

650 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