Solved

Change Dlg text color..

Posted on 1998-12-13
2
293 Views
Last Modified: 2013-11-20
I have a dialog based app. And on that I have for instance a check box. Now say I want that checkbox text color to be blue. Is that possible. I tried something like:
CDC *pDC = m_Check1.GetDC();
pDC->SetTextColor(RGB(0,0,255));
UpdateData(FALSE);
Nothing happens. Since I'm new at MFC there are ofcourse error somewhere, could somneone help me out??
Thanx...
0
Comment
Question by:Slask
2 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 70 total points
ID: 1326149
Create a WM_CTLCOLOR message handler (OnCtlColor) with ClassWizard, which is called for any child control to recieve a brush for painting the controls.

in the OnCtlColor function add something like this:

  int index = pWnd->GetDlgCtrlID();
  switch ( index )
  {
    case(IDC_CHECK1):
      pDC->SetTextColor( RGB( 255, 0, 0 ) );
      break;
    case(IDC_CHECK2):
      pDC->SetTextColor( RGB( 0, 255, 0 ) );
      break;
    }

to set the textcolor of the CheckBoc IDC_CHECK1 to red and the textcolor of IDC_CHECK2 to green.

hope that helps,

ZOPPO
0
 

Author Comment

by:Slask
ID: 1326150
Thank you it worked perfectly...
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

Suggested Solutions

Title # Comments Views Activity
countEvens challenge 2 111
Making an alias 7 101
Message not shown 5 67
moto 4g phone enable finger print 4 26
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 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