Simple way to change dialog’s background and text colors

If you want to change background or text color of your dialog box or form view window you can call
CWinApp::SetDialogBkColor(COLORREF clrCtlBk, COLORREF clrCtlText) function. The first argument of the
function is background color, second is text color.
Call this member function from within the InitInstance member function to set the default background and text
color for dialog boxes and message boxes within your application.

For example, following code sets all application’s dialogs to display a red background and a green text.


BOOL CMyApp::InitInstance()
{

// lets set red background and green text for our dialogs
SetDialogBkColor(RGB(255, 0, 0), RGB(0, 255, 0));

}

Last updated: 13 May 1998

More by Author

Must Read