Solved

Change Dlg text color..

Posted on 1998-12-13
2
311 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
[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
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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

626 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