A statement change dialog background and text color

zhaozj2021-02-17  48

Author: Xiao Feng Gong Jianwei studio

The CLabel class can selectively change Static static text color, background, or set static text to hyperlinks, but if the dialog is all changed to other unified background color and text color, only one statement is required in VC.

First download I have done the sample source program BGTextColor.ziip: Download (VC6.0, Win9x / 2000), I also put a 256 color table for a Word document in the compressed package, which will be very convenient when you choose color.

Here is a detailed programming process:

1. New project: Newly built a dialog-based BGColorDemo project in VC6, accept all default options;

2. Write this statement is to: Find the Bool CBGColorDemoApp :: InitInstance () function in the BGColordemo.cpp file, add SetDialogBkcolor settings in the following position.

BOOL CBgColorDemoApp :: InitInstance () {AfxEnableControlContainer (); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need # ifdef _AFXDLLEnable3dControls ();. // Call this when using MFC in a shared DLL # elseEnable3dControlsStatic (); // Call this when linking to MFC statically # endifCBgColorDemoDlg dlg; m_pMainWnd = & dlg; // add background here Color setting, a statement, more simple, // front RGB set background color, the second RGB set font color setDialogbkcolor (RGB (000, 204, 25), RGB (255, 0, 0)); int NRESPONSE = DLG.DOMODAL (); if (nresponse == idok) {// Todo: Place Code Here to Handle WHEN THE DIALOG IS // DISMISsed with ok} else f (nresponse == idcancel) {// Todo: Place Code Here to Handle WHEN THE Dialog is // dismissed with cancel} // sind, returnaf false, rather Than Start the application,}, pump.return false;

Datual, build -> run, have you been?

转载请注明原文地址:https://www.9cbs.com/read-28764.html

New Post(0)