1. Change the icon
Copy the icon to the resource file, load the project, and set the ID.
In the dialog constructor, modify the icon's ID.
Iconcmfc_framedlg::cmfc_framedlg (cwnd* pparent/*=null*/): CDialog (Cmfc_framedlg::idd, pparent) {M_hIcon = AfxGetApp ()->loadicon (idi_mainframe); Change to New icon ID}
2. Direct Skin Change
Skinshape tools SkinH.dll Skinh.; The IB Skinh.she SkinH.h are copied to the project catalog.
Add in StdAfx.h
<span style= "color: #ff0000;" > #include "SkinH.h" #pragma comment (lib, "SkinH.lib") </span>
dialog box is called before the add
<span style= "color: #ff0000;" > Skinh_attach (); </span> Cmfc_framedlg Dlg;m_pmainwnd = &dlg;int_ptr Nresponse = dlg. DoModal ();
3. Change the background
First load a picture, the image ID is set to IDB_BITMAP1;
Add a definition to the header file:
<pre name= "code" class= "CPP" >public: CBrush m_brbk;
afx_msg hbrush OnCtlColor (cdc* PDC, cwnd* pWnd, UINT nCtlColor);
CPP file, add the following:
BOOL Ctestdlg::oninitdialog () { <span style= "color: #ff0000;" >cdialog::oninitdialog (); CBitmap bmp; Bmp. LoadBitmap (IDB_BITMAP1); M_brbk.createpatternbrush (&bmp); Bmp. DeleteObject ();</span> return TRUE; Return TRUE unless you set the focus to a control}
Add a message map
Begin_message_map (Cmfc_framedlg, CDialog) On_wm_syscommand () On_wm_paint () On_wm_querydragicon () <span style= " Color: #ff0000; " >on_wm_ctlcolor () </span>//}}afx_msg_mapend_message_map ()
The function is implemented as follows:
Hbrush Cmfc_framedlg::onctlcolor (cdc* PDC, cwnd* pWnd, UINT nctlcolor) { Hbrush HBR = Cdialog::onctlcolor (PDC, PWND, n Ctlcolor); if (pWnd = = this) { return m_brbk; } return HBR;}
MFC Learning Interface Beautification <2>