Click here to Skip to main content
15,914,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I change background/text color of CComboBox ? Pin
Ozer Karaagac24-Mar-11 15:58
professionalOzer Karaagac24-Mar-11 15:58 
GeneralRe: How can I change background/text color of CComboBox ? Pin
_Flaviu24-Mar-11 23:36
_Flaviu24-Mar-11 23:36 
GeneralRe: How can I change background/text color of CComboBox ? Pin
వేంకటనారాయణ(venkatmakam)24-Mar-11 23:57
వేంకటనారాయణ(venkatmakam)24-Mar-11 23:57 
GeneralRe: How can I change background/text color of CComboBox ? Pin
_Flaviu25-Mar-11 1:53
_Flaviu25-Mar-11 1:53 
GeneralRe: How can I change background/text color of CComboBox ? Pin
Ozer Karaagac25-Mar-11 2:22
professionalOzer Karaagac25-Mar-11 2:22 
GeneralRe: How can I change background/text color of CComboBox ? Pin
_Flaviu25-Mar-11 2:46
_Flaviu25-Mar-11 2:46 
GeneralRe: How can I change background/text color of CComboBox ? Pin
Ozer Karaagac25-Mar-11 3:13
professionalOzer Karaagac25-Mar-11 3:13 
GeneralRe: How can I change background/text color of CComboBox ? Pin
_Flaviu25-Mar-11 2:59
_Flaviu25-Mar-11 2:59 
To make a review :
ON_MESSAGE(WM_CTLCOLORLISTBOX, OnCtlColorListBox)
ON_WM_CTLCOLOR()

LRESULT CComboBoxExt::OnCtlColorListBox(WPARAM wParam, LPARAM lParam)
{
	// If the listbox hasn't been subclassed yet, do so...
	if(m_hListBox == NULL)
	{
		HWND hWnd = reinterpret_cast<HWND>(lParam);
		if(hWnd != 0 && hWnd != m_hWnd)
		{
			// Save the listbox handle
			m_hListBox = hWnd;
			// Do the subclassing
			m_pWndProc = reinterpret_cast<WNDPROC>(GetWindowLong(m_hListBox, GWL_WNDPROC));
			SetWindowLong(m_hListBox, GWL_WNDPROC, reinterpret_cast<long>(ComboBoxListBoxProc));
		}
	}

	return 1;
}

HBRUSH CComboBoxExt::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CComboBox::OnCtlColor(pDC, pWnd, nCtlColor);

	// TODO: Change any attributes of the DC here

	if(nCtlColor == CTLCOLOR_EDIT)
	{
		if(! m_bAlertText)pDC->SetTextColor(COLOR_BLACK);
		else pDC->SetTextColor(COLOR_RED);
		if(! m_bAlertBkg)pDC->SetBkColor(COLOR_WHITE);
		else
		{
			pDC->SetBkColor(COLOR_ALERT);
			hbr = m_hBrushAlert;
		}
	}

	pDC->SetBkMode(TRANSPARENT);

	// TODO: Return a different brush if the default is not desired

	return hbr;
}

GeneralRe: How can I change background/text color of CComboBox ? Pin
Ozer Karaagac25-Mar-11 3:25
professionalOzer Karaagac25-Mar-11 3:25 
GeneralRe: How can I change background/text color of CComboBox ? Pin
Ozer Karaagac25-Mar-11 3:36
professionalOzer Karaagac25-Mar-11 3:36 
AnswerRe: How can I change background/text color of CComboBox ? Pin
వేంకటనారాయణ(venkatmakam)25-Mar-11 2:40
వేంకటనారాయణ(venkatmakam)25-Mar-11 2:40 
GeneralRe: How can I change background/text color of CComboBox ? Pin
_Flaviu25-Mar-11 6:03
_Flaviu25-Mar-11 6:03 
GeneralRe: How can I change background/text color of CComboBox ? Pin
_Flaviu25-Mar-11 21:27
_Flaviu25-Mar-11 21:27 
GeneralRe: How can I change background/text color of CComboBox ? Pin
mesajflaviu27-Mar-11 22:21
mesajflaviu27-Mar-11 22:21 
QuestionDelete a view Pin
john563224-Mar-11 3:03
john563224-Mar-11 3:03 
AnswerRe: Delete a view Pin
Albert Holguin24-Mar-11 4:24
professionalAlbert Holguin24-Mar-11 4:24 
GeneralRe: Delete a view Pin
john563224-Mar-11 19:45
john563224-Mar-11 19:45 
GeneralRe: Delete a view Pin
Albert Holguin25-Mar-11 3:48
professionalAlbert Holguin25-Mar-11 3:48 
AnswerRe: Delete a view Pin
Richard MacCutchan24-Mar-11 5:47
mveRichard MacCutchan24-Mar-11 5:47 
QuestionSTL : Map.Insert always sort the inserted key - How to prevent this Pin
pandit8424-Mar-11 0:35
pandit8424-Mar-11 0:35 
AnswerRe: STL : Map.Insert always sort the inserted key - How to prevent this Pin
Chris Losinger24-Mar-11 1:03
professionalChris Losinger24-Mar-11 1:03 
AnswerRe: STL : Map.Insert always sort the inserted key - How to prevent this Pin
Stefan_Lang30-Mar-11 1:51
Stefan_Lang30-Mar-11 1:51 
QuestionHow to reduce Flickering ? Pin
002comp23-Mar-11 22:47
002comp23-Mar-11 22:47 
AnswerRe: How to reduce Flickering ? Pin
CPallini23-Mar-11 23:00
mveCPallini23-Mar-11 23:00 
GeneralRe: How to reduce Flickering ? Pin
Maximilien24-Mar-11 2:56
Maximilien24-Mar-11 2:56 

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.