Duilib Learning two first programs Hello world
#pragma once#include <uilib.h>using namespace duilib; #ifdef _debug# ifdef _unicode# pragma comment (lib, "Dui Lib_ud.lib ") # else# pragma comment (lib," Duilib_d.lib ") # endif#else# ifdef _unicode# pragma comment (lib, "Duilib_u.lib") # else# pragma comment (lib, "DuiLib.lib") # Endif#endifclass Cduiframewnd:public Cwindowwnd, PU Blic inotifyui{public:virtual LPCTSTR getwindowclassname () const {return _t ("Duimainframe");} virtual void Notify (tnotifyui& msg) {} virtual LRESULT handlemessage (UINT umsg, WPARAM WPARAM, LPARAM LPARAM) {LRESULT lres = 0; if (umsg = = wm_create) {Ccontrolui *pwnd = new Cbuttonui; Pwnd->settext (_t ("Hello World")); Set text Pwnd->setbkcolor (0XFF00FF00); Set Background color m_paintmanager.init (m_hwnd); M_paintmanager.attachdialog (PWND); return lres; } if (M_paintmanager.messagehandler (umsg, WParam, LParAM, Lres)) {return lres; } return __super::handlemessage (umsg, WParam, LParam); }protected:cpaintmanagerui M_paintmanager;}; int Apientry _tWinMain (hinstance hinstance, hinstance hprevinstance, LPTSTR lpcmdline, int ncmdshow) {cpaintmanagerui:: Setinstance (HINSTANCE); Cduiframewnd Duiframe; Duiframe.create (NULL, _t ("Duiwnd"), Ui_wndstyle_frame, Ws_ex_windowedge); Duiframe.showmodal (); return 0;}
1, the mouse moved to the customer area (green section), the mouse style will become the hand type 2, resizing and maximizing the window, Hello world will adapt to the size of the window, has been centered 3, if you want to change the background color, call SetBkColor directly.
Duilib Learning two first programs Hello world