• 大小: 1.54MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-01
  • 语言: 其他
  • 标签: Duilib  C++  

资源简介

Duilib来实现的登录窗口,VS2010开发平台。 功能不多,只为理解程序与xml。

资源截图

代码片段和文件信息

//2012.10.16     by l0g1n。
#include “stdafx.h“

class CframeWindowWnd:public CWindowWndpublic INotifyUI
{
public:
CframeWindowWnd(){};
LPCTSTR GetWindowClassName() const { return _T(“UIMainframe“); }
void OnPrepare() 
{
}
void Notify(TNotifyUI& msg)
{
if(msg.sType==_T(“windowinit“))
OnPrepare();
else if(msg.sType==_T(“click“))
{
if(msg.pSender==m_pCloseBtn)
{
PostQuitMessage(0);
return;
}else if(msg.pSender==m_pRegisterBtn)
{
MessageBox(NULLm_pNameEdit->GetText()+_T(“\n“)+m_pPasswdEdit->GetText()_T(“注册“)MB_OK);
return;
}else if(msg.pSender==m_pLoginBtn)
{
MessageBox(NULLm_pNameEdit->GetText()+_T(“\n“)+m_pPasswdEdit->GetText()_T(“登录“)MB_OK);
return;
}
}
}
void Init()
{
 m_pCloseBtn = static_cast(m_pm.FindControl(_T(“closebtn“)));
 m_pRegisterBtn=static_cast(m_pm.FindControl(_T(“registerbtn“)));
 m_pLoginBtn=static_cast(m_pm.FindControl(_T(“loginbtn“)));
 m_pNameEdit=static_cast(m_pm.FindControl(_T(“nameedit“)));
 m_pPasswdEdit=static_cast(m_pm.FindControl(_T(“passwdedit“)));
}

    LRESULT OnCreate(UINT uMsg WPARAM wParam LPARAM lParam BOOL& bHandled)
    {
        LONG styleValue = ::GetWindowLong(*this GWL_style);
        styleValue &= ~WS_CAPTION;
        ::SetWindowLong(*this GWL_style styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
        m_pm.Init(m_hWnd);
        //m_pm.SetTransparent(100);
        CDialogBuilder builder;
        CControlUI* pRoot = builder.Create(_T(“login.xml“) (UINT)0 NULL &m_pm);
        ASSERT(pRoot && “Failed to parse xml“);
        m_pm.AttachDialog(pRoot);
        m_pm.AddNotifier(this);
        Init();
        return 0;
    }
    LRESULT OnSize(UINT uMsg WPARAM wParam LPARAM lParam BOOL& bHandled)
    {
        SIZE szRoundCorner = m_pm.GetRoundCorner();//这个是圆角,是椭圆的半径
//这里有个很巧妙的用法,在xml文件中一定要设置圆角(roundcorner),
//不然不会进入下面的if,也就会出现标题栏。
        if( !::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) {
            CRect rcWnd;
            ::GetWindowRect(*this &rcWnd);
            rcWnd.Offset(-rcWnd.left -rcWnd.top);
            rcWnd.right++; rcWnd.bottom++;
            RECT rc = { rcWnd.left rcWnd.top + szRoundCorner.cx rcWnd.right rcWnd.bottom };
            HRGN hRgn1 = ::CreateRectRgnIndirect( &rc );
            HRGN hRgn2 = ::CreateRoundRectRgn(rcWnd.left rcWnd.top rcWnd.right rcWnd.bottom - szRoundCorner.cx szRoundCorner.cx szRoundCorner.cy);
            ::CombineRgn( hRgn1 hRgn1 hRgn2 RGN_OR );
            ::SetWindowRgn(*this hRgn1 TRUE);
            ::Deleteobject(hRgn1);
            ::Deleteobject(hRgn2);
        }

        bHandled = FALSE;
        return 0;
    }
    LRESULT OnGetMinMaxInfo(UINT uMsg WPARAM wParam LPARAM lParam BOOL& bHandled)
    {
        MONITORINFO oMonitor = {};
        oMonitor.cbSize = sizeof(oMonitor);
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      48640  2012-10-16 21:33  Login\Debug\Login.exe

     文件      89467  2012-10-16 16:34  Login\Debug\skin\bk_image.png

     文件       2358  2010-01-23 22:10  Login\Debug\skin\frame_btn_close_down.bmp

     文件       2358  2012-10-16 21:18  Login\Debug\skin\frame_btn_close_hot.bmp

     文件       2358  2012-10-16 21:17  Login\Debug\skin\frame_btn_close_normal.bmp

     文件       1182  2012-10-16 21:30  Login\Debug\skin\login.xml

     文件        566  2012-10-16 21:33  Login\Login\Debug\cl.command.1.tlog

     文件      15124  2012-10-16 21:33  Login\Login\Debug\CL.read.1.tlog

     文件        208  2012-10-16 21:33  Login\Login\Debug\CL.write.1.tlog

     文件          2  2012-10-16 21:33  Login\Login\Debug\link-cvtres.read.1.tlog

     文件          2  2012-10-16 21:33  Login\Login\Debug\link-cvtres.write.1.tlog

     文件          2  2012-10-16 21:33  Login\Login\Debug\link.7520-cvtres.read.1.tlog

     文件          2  2012-10-16 21:33  Login\Login\Debug\link.7520-cvtres.write.1.tlog

     文件          2  2012-10-16 21:33  Login\Login\Debug\link.7520.read.1.tlog

     文件          2  2012-10-16 21:33  Login\Login\Debug\link.7520.write.1.tlog

     文件       1246  2012-10-16 21:33  Login\Login\Debug\link.command.1.tlog

     文件       2502  2012-10-16 21:33  Login\Login\Debug\link.read.1.tlog

     文件        480  2012-10-16 21:33  Login\Login\Debug\link.write.1.tlog

     文件        406  2012-10-16 20:13  Login\Login\Debug\Login.exe.embed.manifest

     文件        472  2012-10-16 20:13  Login\Login\Debug\Login.exe.embed.manifest.res

     文件        381  2012-10-16 21:33  Login\Login\Debug\Login.exe.intermediate.manifest

     文件         44  2012-10-16 21:33  Login\Login\Debug\Login.lastbuildstate

     文件       1986  2012-10-16 21:33  Login\Login\Debug\Login.log

     文件      64234  2012-10-16 21:33  Login\Login\Debug\login.obj

     文件        200  2012-10-16 19:48  Login\Login\Debug\Login_manifest.rc

     文件        328  2012-10-16 21:33  Login\Login\Debug\mt.command.1.tlog

     文件        222  2012-10-16 21:33  Login\Login\Debug\mt.read.1.tlog

     文件        222  2012-10-16 21:33  Login\Login\Debug\mt.write.1.tlog

     文件        420  2012-10-16 20:13  Login\Login\Debug\rc.command.1.tlog

     文件        194  2012-10-16 20:13  Login\Login\Debug\rc.read.1.tlog

............此处省略66个文件信息

评论

共有 条评论