Free text display for several minutes to make your dialog box or view text colorful
Liberation text display Processing
Do not waste your time on text display processing, and make your text display colorful in just a few minutes.
Example: a text message is displayed on the cstatic control of the dialog box:
Code:
Shuhuadll instructions:
In the dialog box, add the View:
In the dialog box, place a text control cstatic idc_static that carries the view.
Step 1: Hear the DLL header file in the header file of the dialog box
# Include "shuhuadll \ factory. H" // Add the view header file to the header file # include "shuhuadll \ shuhuavclass. H" // Add the view header file to the header file.
Step 2: Add member variables in the dialog box
CFrameWnd * m_pFrame; ShuhuaVClass* m_pView;
Step 3: Add the following code to the oninitdialog () function initialized in the dialog box
Uint targetctrlid = idc_static; cwnd * pwnd = getdlgitem (targetctrlid); crect recttargetctrl; pwnd-> getwindowrect (recttargetctrl); pwnd-> destroywindow (); // get the idc_static screen rect this-> screentoclient (recttargetctrl); m_pview = Factory: getshuhuav (); // obtain the view pointer m_pframe = new cframewnd (); m_pframe-> Create (null, null, ws_visible | ws_child, recttargetctrl, this); If (null = m_pview) {return false ;} // initialize the view and set the displayed content m_pview-> createwindowshuhua (recttargetctrl, m_pframe); m_pview-> setwindowpos (recttargetctrl); m_pview-> setfile (L "Shuhua. XML "); // Shuhua. XML is located in the res \ folder and changes the content to its m_pview-> Init ();
Step 4: destroy the view in the Destructor or destroy function of the dialog box.
Factory::Destory ();
Demo; www.gudianxiaoshuo.com
Publish a text interface library. Release text display for several minutes. Make your dialog box or view text colorful.