Change Background color:
1. Call in APP initialization function:
Void setdialogbkcolor (colorrefClrctlbk= RGB (192,192,192), colorrefClrctltext= RGB (0, 0, 0 ));
2. In onctlcolor:
If (nctlcolor = ctlcolor_dlg)
{
Cbrush * Brush;
Brush = new cbrush (RGB (221,221,221 ));
Return (hbrush) (Brush-> m_hobject );
}
Set the background bitmap:
Cbitmap m_bmp background;
M_bmp background.loadbitmap (idb_background );
Onpaint ()
{
Cbkdialog: onpaint ();
/*
Cpaintdc DC (this); // The DC in the dialog box
CDC dcmem;
Dcmem. createcompatibledc (& DC); // create a memory DC compatible with the dialog box DC
Crect rect;
Getclientrect (& rect );
Bitmap bitmap;
M_bmp background.getbitmap (& Bitmap );
Cbitmap * pbmpold = dcmem. SelectObject (& m_bmp background); // select the background bitmap to the memory DC.
DC. stretchblt (0, 0, rect. width (), rect. height (), & dcmem, 0, bitmap. bmwidth, bitmap. bmheight, srccopy); // stretch the bitmap in the memory DC to the DC in the dialog box.
// Dc. bitblt (, rect. Width (), rect. Height (), & dcmem, srccopy );
}