Click here to Skip to main content
15,921,884 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalbuttons and word doc's Pin
N.Byarley8-Oct-03 14:37
N.Byarley8-Oct-03 14:37 
GeneralRe: buttons and word doc's Pin
Terry O'Nolley8-Oct-03 18:45
Terry O'Nolley8-Oct-03 18:45 
GeneralRe: buttons and word doc's Pin
N.Byarley8-Oct-03 20:33
N.Byarley8-Oct-03 20:33 
GeneralRe: buttons and word doc's Pin
Terry O'Nolley8-Oct-03 23:32
Terry O'Nolley8-Oct-03 23:32 
QuestionHow can I make the property sheet buttons in the XP style? Pin
bin89228-Oct-03 13:19
bin89228-Oct-03 13:19 
Generalwarning C4273 - inconsistent dll linkage. dllexport assumed. Pin
YaronNir8-Oct-03 12:54
YaronNir8-Oct-03 12:54 
QuestionHow to change the color of the dialog box Pin
Deepak Samuel8-Oct-03 12:15
Deepak Samuel8-Oct-03 12:15 
AnswerRe: How to change the color of the dialog box Pin
YaronNir8-Oct-03 13:16
YaronNir8-Oct-03 13:16 
Hi,

there are several ways to change the dialog bk color:
1) use SetDialogBKColor() method in the InitInstance()
2) use OnColorCtl() Message handler
3) draw a rectangle that will cover the entire dialog

i prefer to use the second method

here is an example code on how to use it:

in the *.h file write down:

protected:<br />
	// Generated message map functions<br />
	//{{AFX_MSG(CGUIBaseDlg)<br />
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);


in the *.cpp file write an entry in the message map:

BEGIN_MESSAGE_MAP(CYourDlg, CDialog)<br />
	//{{AFX_MSG_MAP(CGUIBaseDlg)<br />
	ON_WM_CTLCOLOR()<br />
END_MESSAGE_MAP()


implenent the OnColorCtl , write down:

HBRUSH CGUIBaseDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
	if (CTLCOLOR_DLG == nCtlColor)<br />
		hbr = m_brushDlgBk;<br />
<br />
<br />
	return hbr;<br />
}


notice the use of brushDlgBk.

in the *.h file define the brush:

CBrush m_brushDlgBk;

in the *.cpp file in the constructor of the dialog
create the brush:

m_brushDlgBk.CreateSolidBrush(RGB(200,200,200))// the color you chose place here
that should do the trick....

to switch the colors on a click just use 2 brushes and return the proper one in the OnCtlColor method according to a flag indicating the click

hope i helped ya

Yaron

Ask not what your application can do for you,
Ask what you can do for your application
QuestionEM_STREAMOUT and EditStreamCallback() function? Pin
Kayembi8-Oct-03 12:07
Kayembi8-Oct-03 12:07 
QuestionHow to make a dialog box pop up on receiving an event Pin
Deepak Samuel8-Oct-03 11:18
Deepak Samuel8-Oct-03 11:18 
GeneralWindows Xp Style Buttons Pin
Marissa1828-Oct-03 11:14
Marissa1828-Oct-03 11:14 
GeneralRe: Windows Xp Style Buttons Pin
Ravi Bhavnani8-Oct-03 11:51
professionalRavi Bhavnani8-Oct-03 11:51 
General&quot;This&quot; adress changing in the same object Pin
Chris Gilbert8-Oct-03 10:27
Chris Gilbert8-Oct-03 10:27 
GeneralRe: &quot;This&quot; adress changing in the same object Pin
Tim Smith8-Oct-03 11:19
Tim Smith8-Oct-03 11:19 
GeneralRe: &quot;This&quot; adress changing in the same object Pin
Chris Gilbert9-Oct-03 11:02
Chris Gilbert9-Oct-03 11:02 
GeneralRe: &quot;This&quot; adress changing in the same object Pin
ZoogieZork8-Oct-03 16:35
ZoogieZork8-Oct-03 16:35 
GeneralDisplaying images on CWnd dervied windows Pin
Ph@ntom8-Oct-03 9:49
Ph@ntom8-Oct-03 9:49 
General1 day only! I will answer your beginner home-work assignments! Pin
Terry O'Nolley8-Oct-03 9:24
Terry O'Nolley8-Oct-03 9:24 
GeneralRe: 1 day only! I will answer your beginner home-work assignments! Pin
Ryan_Roberts8-Oct-03 9:58
Ryan_Roberts8-Oct-03 9:58 
GeneralRe: 1 day only! I will answer your beginner home-work assignments! Pin
Terry O'Nolley8-Oct-03 17:28
Terry O'Nolley8-Oct-03 17:28 
GeneralRe: 1 day only! I will answer your beginner home-work assignments! Pin
Anonymous8-Oct-03 11:01
Anonymous8-Oct-03 11:01 
GeneralRe: 1 day only! I will answer your beginner home-work assignments! Pin
Terry O'Nolley8-Oct-03 16:30
Terry O'Nolley8-Oct-03 16:30 
GeneralRe: 1 day only! I will answer your beginner home-work assignments! Pin
David Stone8-Oct-03 19:08
sitebuilderDavid Stone8-Oct-03 19:08 
GeneralRe: 1 day only! I will answer your beginner home-work assignments! Pin
Mike Danberg8-Oct-03 17:09
Mike Danberg8-Oct-03 17:09 
GeneralRe: 1 day only! I will answer your beginner home-work assignments! Pin
David Stone8-Oct-03 19:12
sitebuilderDavid Stone8-Oct-03 19:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.