Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CDC::SetBkColor

Posted on 1998-03-01
2
Medium Priority
?
1,029 Views
Last Modified: 2013-11-20
I dont think im using the SetBkColor function properly.  Could anyone help me out with what im doing wrong?
I've got a dialog box.  It's InitInstance creates a modeless dialog box.  Trying to get a device context to the dialog box and change its background color.
Here's a clip of what im doing:
/////////////////////////////////////////////////////////////////////////////
m_cDlg2.Create( IDD_INFO, this );  //Using CDialog::Create
CDC*      pdcWindow = m_cDlg2.GetWindowDC( );
pdcWindow->SetBkColor( COLORREF( 100, 0, 0));
pdcWindow->UpdateColors();
m_cDlg2.ShowWindow(SW_SHOW);
///////////////////Another Attempt//////////////////////////////////////
m_cDlg2.Create( IDD_INFO, this );
CDC      dcWindow = m_cDlg2.GetWindowDC( );
pdcWindow.SetBkColor( RGB( 100, 0, 0));
pdcWindow.UpdateColors();
m_cDlg2.ShowWindow(SW_SHOW);
/////////////////////////////////////////////////////////////////////////////
The main dialog window appears and the Dlg2 window but no color change.
When i call GetBkColor it returns 0xffffff which i guess is the gray.
Also, im not sure in th line
m_cDlg2.Create( IDD_INFO, this );
whether 'this' points to the main dialog box or the Dlg2 dialog box.

Thanks in advance
0
Comment
Question by:bod_1
[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 23

Accepted Solution

by:
chensu earned 200 total points
ID: 1316691
You should call CWinApp::SetDialogBkColor rather than CDC::SetBkColor().

void SetDialogBkColor( COLORREF clrCtlBk = RGB(192, 192, 192), COLORREF clrCtlText = RGB(0, 0, 0) );

0
 

Author Comment

by:bod_1
ID: 1316692
Thanks Chensu,  I'll give that one a go.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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. …
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

730 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