Duilib Learning Three-response button

Source: Internet
Author: User

1 #pragmaOnce2#include <UIlib.h>3 using namespaceDuilib;4 5 #ifdef _DEBUG6 # ifdef _unicode7# pragma comment (lib,"Duilib_ud.lib")8#Else9# pragma comment (lib,"Duilib_d.lib")Ten # endif One #else A # ifdef _unicode -# pragma comment (lib,"Duilib_u.lib") -#Else the# pragma comment (lib,"DuiLib.lib") - # endif - #endif -  + classCduiframewnd: PublicCwindowwnd, PublicInotifyui - { +  Public: A     VirtualLPCTSTR Getwindowclassname ()Const{return_t ("Duimainframe"); } at     Virtual voidNotify (tnotifyui&msg) -     { -         if(Msg.stype = = _t ("Click")) -         { -             if(Msg.psender->getname () = = _t ("Btnhello"))  -             { in:: MessageBox (NULL, _t ("I'm the button ."), _t ("Click the button"), NULL); -             } to         } +     } -  the     VirtualLRESULT handlemessage (UINT umsg, WPARAM WPARAM, LPARAM LPARAM) *     { $LRESULT lres =0;Panax Notoginseng  -         if(umsg = =wm_create) the         { +Ccontrolui *pwnd =NewCbuttonui; APwnd->setname (_t ("Btnhello"));//Sets the name of the control, which is used to identify each control and must be unique, equivalent to the control ID in MFC thePwnd->settext (_t ("Hello World"));//Set Text +Pwnd->setbkcolor (0xff00ff00);//Set Background color -  $ M_paintmanager.init (m_hwnd); $ M_paintmanager.attachdialog (pWnd); -M_paintmanager.addnotifier ( This);//Add a message response such as a control, so that the message will be communicated to the DUILIB message loop, we can do the message processing in the Notify function -             returnLres; the         } - Wuyi         if(M_paintmanager.messagehandler (umsg, WParam, LParam, lres)) the         { -             returnLres; Wu         } -  About         return__super::handlemessage (umsg, WParam, LParam); $     } -  - protected: - Cpaintmanagerui M_paintmanager; A }; +  the intApientry _tWinMain (hinstance hinstance, hinstance hprevinstance, LPTSTR lpCmdLine,intncmdshow) - { $ cpaintmanagerui::setinstance (hinstance); the  the Cduiframewnd Duiframe; theDuiframe.create (NULL, _t ("Duiwnd"), Ui_wndstyle_frame, Ws_ex_windowedge); the Duiframe.showmodal (); -     return 0; in}




Duilib Learning Three-response button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.