Solved

CDC::SetBkColor

Posted on 1998-03-01
2
965 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
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
Comment Utility
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
Comment Utility
Thanks Chensu,  I'll give that one a go.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now