Click here to Skip to main content
15,910,878 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionPlaySound (MFC) Pin
YUANGE29-Apr-07 1:58
YUANGE29-Apr-07 1:58 
AnswerRe: PlaySound (MFC) Pin
Mark Salsbery29-Apr-07 8:13
Mark Salsbery29-Apr-07 8:13 
QuestionRegistering a PKCS#12 file Pin
Andy H29-Apr-07 0:23
Andy H29-Apr-07 0:23 
AnswerRe: Registering a PKCS#12 file Pin
cmk29-Apr-07 0:50
cmk29-Apr-07 0:50 
Questionnavigate a dialog using up and down arrows and not tab... Pin
Joan M29-Apr-07 0:19
professionalJoan M29-Apr-07 0:19 
AnswerRe: navigate a dialog using up and down arrows and not tab... Pin
GuyM29-Apr-07 1:03
GuyM29-Apr-07 1:03 
GeneralRe: navigate a dialog using up and down arrows and not tab... Pin
Joan M29-Apr-07 1:06
professionalJoan M29-Apr-07 1:06 
QuestionHow to change the background color of a button? Pin
eli1502197928-Apr-07 23:56
eli1502197928-Apr-07 23:56 
Hi,

I'm trying to change the background color of a button (CButton type).
In order to acheive that,I'm using the ON_WM_CTLCOLOR() message,
but i'm unable to change the background color.
My code is as follow (directly from the MSDN...with few changes) :
HBRUSH CFailureListFeasibilityDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
        CBrush brush;

	// TODO:  Change any attributes of the DC here
	if (pWnd->GetDlgCtrlID() == IDC_MYBUTTON)
	{
		// Set the text color to red
		pDC->SetTextColor(RGB(0, 250, 250));

		// Set the background mode for text to transparent 
		// so background will show thru.
		pDC->SetBkColor(RGB(255,0,0));

		// Return handle to our CBrush object
	        brush.CreateSolidBrush(RGB(0,0,0));
		hbr = brush;
	}

	// TODO:  Return a different brush if the default is not desired
	return hbr;
}


When debugging,I'm entering the "if" statement,but the backgroung color
remains the same.
Can anyone help me?Frown | :(

With best regards,
Eli
QuestionRe: How to change the background color of a button? [modified] Pin
Doc Lobster29-Apr-07 0:20
Doc Lobster29-Apr-07 0:20 
AnswerRe: How to change the background color of a button? Pin
eli1502197929-Apr-07 1:08
eli1502197929-Apr-07 1:08 
AnswerRe: How to change the background color of a button? Pin
Joan M29-Apr-07 1:04
professionalJoan M29-Apr-07 1:04 
GeneralRe: How to change the background color of a button? Pin
eli1502197929-Apr-07 1:16
eli1502197929-Apr-07 1:16 
GeneralRe: How to change the background color of a button? Pin
Joan M29-Apr-07 1:24
professionalJoan M29-Apr-07 1:24 
AnswerRe: How to change the background color of a button? Pin
Michael Dunn29-Apr-07 21:00
sitebuilderMichael Dunn29-Apr-07 21:00 
QuestionHow to Understand the macro ON_ONCTROL_RANGE Pin
cnhnyu28-Apr-07 23:53
cnhnyu28-Apr-07 23:53 
AnswerRe: How to Understand the macro ON_ONCTROL_RANGE Pin
Michael Dunn29-Apr-07 21:03
sitebuilderMichael Dunn29-Apr-07 21:03 
GeneralRe: How to Understand the macro ON_ONCTROL_RANGE Pin
cnhnyu1-May-07 18:23
cnhnyu1-May-07 18:23 
QuestionA difficult decision, C programming Pin
C_Zealot28-Apr-07 22:58
C_Zealot28-Apr-07 22:58 
AnswerRe: A difficult decision, C programming Pin
Arun.Immanuel28-Apr-07 23:45
Arun.Immanuel28-Apr-07 23:45 
GeneralRe: A difficult decision, C programming Pin
C_Zealot28-Apr-07 23:52
C_Zealot28-Apr-07 23:52 
GeneralRe: A difficult decision, C programming Pin
Arun.Immanuel29-Apr-07 0:05
Arun.Immanuel29-Apr-07 0:05 
GeneralRe: A difficult decision, C programming Pin
C_Zealot29-Apr-07 0:08
C_Zealot29-Apr-07 0:08 
QuestionAbout Audio-network program Pin
kcynic28-Apr-07 22:35
kcynic28-Apr-07 22:35 
AnswerRe: About Audio-network program Pin
Mark Salsbery29-Apr-07 8:21
Mark Salsbery29-Apr-07 8:21 
GeneralRe: About Audio-network program Pin
kcynic29-Apr-07 16:37
kcynic29-Apr-07 16:37 

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.