/* Add a background image */
BOOL CTOOLDlg: OnEraseBkgnd (CDC * pDC)
{
// TODO: add the message processing program code and/or call the default value here
CDialog: OnEraseBkgnd (pDC );
HBITMAP m_hBitmap;
HDC m_hBkDC;
M_hBitmap =: LoadBitmap (: GetModuleHandle (NULL), MAKEINTRESOURCE (IDB_BITMAP2 ));
M_hBkDC =: CreateCompatibleDC (pDC-> m_hDC );
If (m_hBitmap & m_hBkDC)
{
: SelectObject (m_hBkDC, m_hBitmap );
: StretchBlt (pDC-> m_hDC, 700,610, 700,610, m_hBkDC, SRCCOPY );
: DeleteObject (m_hBitmap );
: DeleteDC (m_hBkDC );
}
Return TRUE;
}
/* Set the control background to transparent */
HBRUSH CTOOLDlg: OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialogEx: OnCtlColor (pDC, pWnd, nCtlColor );
If (nCtlColor = CTLCOLOR_STATIC)
{
PDC-> SetBkMode (TRANSPARENT); // sets the background transparency.
PDC-> SetTextColor (RGB (255,255, 0); // set the font to yellow
Return (HBRUSH): GetStockObject (NULL_BRUSH );
}
// TODO: if the default paint brush is not required, another paint brush is returned.
Return hbr;
}