I want to change the colour of just two labels on a dialog, but I can only get the first label to change (Black backgroud with yellow text). I cant find the reason why the other If (ctrl2 == pWnd) will not work. It never goes in even then the pWnd is the same value as it.
What am I missing? .. See code below
BRUSH CTabFive::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
/* Arrange for the labels to be drawn in yellow on a black background. Also need to arrange for the background colour of the control to be black. */
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// Just want to arrange for the 2 IDU Last Key Press labels to be
// coloured yellow on a black background
if(nCtlColor == CTLCOLOR_STATIC)
{
CWnd* ctrl1 = GetDlgItem (IDC_IDU1_LASTKEY);
CWnd* ctrl2 = GetDlgItem (IDC_IDU2_LASTKEY);
//Is it one of the 2 label we are interested in
if(ctrl1 == pWnd)
{
pDC->SetBkColor(BLACK_BRUSH);
pDC->SetTextColor(RGB(255,255,0));
ctrl2 = pWnd;
return (HBRUSH)GetStoc
What am I missing? .. See code below
BRUSH CTabFive::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
/* Arrange for the labels to be drawn in yellow on a black background. Also need to arrange for the background colour of the control to be black. */
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// Just want to arrange for the 2 IDU Last Key Press labels to be
// coloured yellow on a black background
if(nCtlColor == CTLCOLOR_STATIC)
{
CWnd* ctrl1 = GetDlgItem (IDC_IDU1_LASTKEY);
CWnd* ctrl2 = GetDlgItem (IDC_IDU2_LASTKEY);
//Is it one of the 2 label we are interested in
if(ctrl1 == pWnd)
{
pDC->SetBkColor(BLACK_BRUSH);
pDC->SetTextColor(RGB(255,255,0));
ctrl2 = pWnd;
return (HBRUSH)GetStoc