Click here to Skip to main content
15,907,493 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: show fields from a table on a Listbox Control using MFC VC++ Pin
David Crow13-Nov-03 9:04
David Crow13-Nov-03 9:04 
GeneralRe: show fields from a table on a Listbox Control using MFC VC++ Pin
valikac13-Nov-03 9:07
valikac13-Nov-03 9:07 
GeneralRe: show fields from a table on a Listbox Control using MFC VC++ Pin
David Crow13-Nov-03 9:12
David Crow13-Nov-03 9:12 
GeneralLPCOLESTR Pin
act_x13-Nov-03 5:24
act_x13-Nov-03 5:24 
GeneralRe: LPCOLESTR Pin
Michael Dunn13-Nov-03 8:08
sitebuilderMichael Dunn13-Nov-03 8:08 
Generalthread exit with code 13 Pin
avallet13-Nov-03 4:30
avallet13-Nov-03 4:30 
GeneralRe: thread exit with code 13 Pin
Michael Dunn13-Nov-03 8:09
sitebuilderMichael Dunn13-Nov-03 8:09 
GeneralWM_CTRLCOLOR Pin
Alton Williams13-Nov-03 3:51
Alton Williams13-Nov-03 3:51 
Hi,
I've subclassed a an edit control from CEdit.
below is what's in the header file:

class CMyEdit: public CEdit<br />
{<br />
public:<br />
void ChangeColour(const unsigned long &bg, const unsigned long &fg);<br />
	// Generated message map functions<br />
protected:<br />
	//{{AFX_MSG(CEditEx)<br />
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);<br />
	//}}AFX_MSG<br />
<br />
	DECLARE_MESSAGE_MAP()<br />
private:<br />
	CBrush m_brush;<br />
	unsigned long TextColour;<br />
	unsigned long BKColour;<br />
	CFont m_TextFont;<br />
};<br />
<br />
}<br />

the methods in my C++ files are:
HBRUSH CMyEdit::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
	HBRUSH hbr = CEdit::OnCtlColor(pDC, pWnd, nCtlColor);<br />
	<br />
	// TODO: Change any attributes of the DC here<br />
	pDC->SetTextColor(TextColour);<br />
	<br />
	// TODO: Return a different brush if the default is not desired<br />
	return m_brush;<br />
}<br />
<br />

void CMyEdit::ChangeColour(const unsigned long &fg, const unsigned long &bg)<br />
{<br />
	TextColour = fg;<br />
	BKColour = bg;<br />
	m_brush.DeleteObject();<br />
	m_brush.CreateSolidBrush(BKColour);<br />
	Invalidate();<br />


My problem is why the method OnCtlColor is NOT being called?
Any explanations

Thanks, Alton
GeneralRe: WM_CTRLCOLOR Pin
Steve S13-Nov-03 4:29
Steve S13-Nov-03 4:29 
Generalpositioning problem Pin
ns13-Nov-03 3:45
ns13-Nov-03 3:45 
GeneralRe: positioning problem Pin
Ravi Bhavnani13-Nov-03 5:23
professionalRavi Bhavnani13-Nov-03 5:23 
AnswerRe: How can I Enable Drag&amp;Drop of IE URL's in my prog Pin
Mike Dimmick13-Nov-03 3:34
Mike Dimmick13-Nov-03 3:34 
GeneralStrange network speed question Pin
Mathias S.13-Nov-03 3:09
Mathias S.13-Nov-03 3:09 
GeneralRe: Strange network speed question Pin
valikac13-Nov-03 9:10
valikac13-Nov-03 9:10 
Generalthreads Pin
snmail13-Nov-03 2:59
snmail13-Nov-03 2:59 
GeneralRe: threads Pin
David Crow13-Nov-03 4:02
David Crow13-Nov-03 4:02 
GeneralRe: threads Pin
valikac13-Nov-03 9:11
valikac13-Nov-03 9:11 
QuestionAutomatic C++ class diagram generation? Pin
Salvador Dali13-Nov-03 2:59
Salvador Dali13-Nov-03 2:59 
AnswerRe: Automatic C++ class diagram generation? Pin
FearlessBurner13-Nov-03 5:16
FearlessBurner13-Nov-03 5:16 
AnswerVisio Pin
dog_spawn13-Nov-03 5:17
dog_spawn13-Nov-03 5:17 
AnswerRe: Automatic C++ class diagram generation? Pin
Maximilien13-Nov-03 5:22
Maximilien13-Nov-03 5:22 
AnswerRe: Automatic C++ class diagram generation? Pin
Ravi Bhavnani13-Nov-03 5:49
professionalRavi Bhavnani13-Nov-03 5:49 
GeneralRe: Automatic C++ class diagram generation? Pin
Salvador Dali13-Nov-03 11:37
Salvador Dali13-Nov-03 11:37 
GeneralRe: Automatic C++ class diagram generation? Pin
Ravi Bhavnani13-Nov-03 12:50
professionalRavi Bhavnani13-Nov-03 12:50 
GeneralRe: Automatic C++ class diagram generation? Pin
Steve S13-Nov-03 22:06
Steve S13-Nov-03 22:06 

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.