Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

How identify specific control in OnCtlColor() and how set colors for Date-Time Control Display

$
0
0

I have two related OnCtlColor() questions:

1. How do I identify a specific control? I want to change the colors of just one control. I have tried checking pWnd->GetDlgCtrlID() == ID_MAIN_ORGNAME but bizarrely (to me) it then affects only specific controls, but not ID_MAIN_ORGNAME.

2. How do I color the "display window" (not the calendar "picker" -- although that would be okay also) of a Date-Time Control.

I freely admit I don't fully "get" OnCtlColor.

Here's what I have:

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


	if ( pWnd->GetDlgCtrlID() == ID_MAIN_ORGNAME )        
	//if (nCtlColor == CTLCOLOR_EDIT)        
	{
		//pDC->SetBkMode(OPAQUE);        
		pDC->SetBkColor(RGB(0,255,0));
		pDC->SetTextColor(RGB(255,0,0));
	}

	return hbr;
}

Thanks!


Charles


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>