Solved

Change Dlg text color..

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 78
has77  challenge 9 82
Way to decrease size of apk file 9 65
Capture logon name 13 70
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.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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