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

IT Offers

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Go Deeper

  • This interactive white paper from CIO Magazine and EMC lays out the benefits of big data and predictive analytics, provides tips on how to …
  • This buyers guide provides independent research and test results to help you determine your endpoint protection requirements and identify …
  • Increasing demands placed on IT, along with tightening budgets has prompted IT leaders to seek out alternative technologies and improved …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds