资源简介
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\fr
文件 2358 2012-10-16 21:18 Login\Debug\skin\fr
文件 2358 2012-10-16 21:17 Login\Debug\skin\fr
文件 1182 2012-10-16 21:30 Login\Debug\skin\login.xm
文件 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\li
文件 2 2012-10-16 21:33 Login\Login\Debug\li
文件 2 2012-10-16 21:33 Login\Login\Debug\li
文件 2 2012-10-16 21:33 Login\Login\Debug\li
文件 2 2012-10-16 21:33 Login\Login\Debug\li
文件 2 2012-10-16 21:33 Login\Login\Debug\li
文件 1246 2012-10-16 21:33 Login\Login\Debug\li
文件 2502 2012-10-16 21:33 Login\Login\Debug\li
文件 480 2012-10-16 21:33 Login\Login\Debug\li
文件 406 2012-10-16 20:13 Login\Login\Debug\Login.exe.em
文件 472 2012-10-16 20:13 Login\Login\Debug\Login.exe.em
文件 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个文件信息
相关资源
- VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- 使用选择性重传协议实现UDP可靠通信
- VC 获得文件属性 获取文件的创建时
- 读者写者问题(读者优先,写者优先
- 用VC 编写的仿QQ聊天室程序源代码
- 外点法程序
- 外罚函数程序
- qt-电子点菜系统
- 推箱子及人工智能寻路C 源代码
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- MUSIC算法c 实现
- C 餐厅叫号系统(QT平)
- 国际象棋c 完整版
-
ob
jectARX给Auto CAD加工具条 - 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- c 课程设计 职工信息管理系统
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- 清华大学 c 郑莉 ppt课件
- c 程序判断离散数学中命题公式
- 多项式求和(数据结构C 版)
- vc 6.0开发的流程图编辑器
- VC 天空盒(skyBox)实现(附源代码)
- c MFC 画多边形
- 用C 实现的对网络上的ARP数据包进行
- Microsoft基本类库 (MFC)(C 库)
川公网安备 51152502000135号
评论
共有 条评论