Solved

Any way to change background color of a readonly CEdit?

Posted on 2001-08-23
6
412 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change owner from userA to server Local Administrators 7 63
Prevent this page from creating additional dialogs. 3 537
firstChar challenge 13 115
unix example issues 18 91
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

823 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