Solved

CDC::SetBkColor

Posted on 1998-03-01
2
992 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 50 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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
bobThere java chalenge 45 95
conditional code and condition difference 9 85
twoTwo  challenge 35 112
ShiftLeft challenge 21 88
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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