备份
1
demo/QQ/QQ.rc
Normal file
@@ -0,0 +1 @@
|
||||
my_res EZUI_RES QQ.res
|
||||
BIN
demo/QQ/QQ.res
Normal file
47
demo/QQ/loginForm.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "loginForm.h"
|
||||
|
||||
LoginForm::LoginForm() :LayeredWindow(320, 448)
|
||||
{
|
||||
umg.LoadXml("res/loginForm.htm");//加载xml里面的控件与样式
|
||||
umg.SetupUI(this);
|
||||
}
|
||||
void LoginForm::OnNotify(Control* sender, EventArgs& args)
|
||||
{
|
||||
if (args.EventType == Event::OnMouseDown) {
|
||||
if (sender->Name == "btnLogin") {
|
||||
TextBox* editUser = (TextBox*)FindControl("user");
|
||||
TextBox* editpwd = (TextBox*)FindControl("pwd");
|
||||
CheckBox* ckbox = (CheckBox*)FindControl("ckbox");
|
||||
if (!ckbox->GetCheck()) {
|
||||
::MessageBox(Hwnd(), L"请阅读协议并勾选!", L"提示", MB_OK);
|
||||
return;
|
||||
}
|
||||
UIString user = editUser->GetText();
|
||||
UIString pwd = editpwd->GetText();
|
||||
if (user == "718987717" && pwd == "123456") {
|
||||
::MessageBox(Hwnd(), L"登录成功!", L"提示", MB_OK);
|
||||
}
|
||||
else {
|
||||
::MessageBox(Hwnd(), L"用户名或密码错误!", L"提示", MB_OK);
|
||||
}
|
||||
}
|
||||
if (sender->Name == "btnExit") {
|
||||
Application::Exit();
|
||||
}
|
||||
if (!sender->GetAttribute("url").empty()) {
|
||||
::ShellExecuteA(0, "open", sender->GetAttribute("url").c_str(), "", "", SW_SHOW);
|
||||
}
|
||||
}
|
||||
__super::OnNotify(sender, args);
|
||||
}
|
||||
|
||||
void LoginForm::OnClose(bool& bClose)
|
||||
{
|
||||
//bClose = false;
|
||||
Application::Exit();
|
||||
}
|
||||
|
||||
LoginForm::~LoginForm()
|
||||
{
|
||||
|
||||
}
|
||||
37
demo/QQ/loginForm.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "ezui/Application.h" //app类
|
||||
#include "EzUI/Window.h" //基础窗口类
|
||||
#include "EzUI/Button.h" //按钮
|
||||
#include "EzUI/TextBox.h" //文本框
|
||||
#include "EzUI/CheckBox.h" //复选框
|
||||
#include "EzUI/PictureBox.h" //图片控件
|
||||
#include "EzUI/TabLayout.h" //选项卡控件
|
||||
#include "EzUI/VLayout.h" //垂直布局
|
||||
#include "EzUI/HLayout.h"//水平布局
|
||||
#include "EzUI/VListView.h"//垂直带滚动条列表
|
||||
#include "EzUI/HListView.h"//水平带滚动条列表
|
||||
#include "EzUI/TileListView.h"//瓦片列表
|
||||
#include "EzUI/LayeredWindow.h"//分层窗口类-可以异型透明窗口
|
||||
#include "ezui/UIManager.h"//ui管理类(使用xml生成控件)
|
||||
|
||||
#pragma comment(lib,"ezui.lib")
|
||||
using namespace ezui;
|
||||
|
||||
using Form = LayeredWindow; //支持异形透明窗口(带阴影)
|
||||
//using Form = BorderlessWindow; //常规无边框窗口(带阴影)
|
||||
//using Form = Window; //标准窗口(带系统标题栏)
|
||||
|
||||
//登录窗口
|
||||
class LoginForm :public Form
|
||||
{
|
||||
private:
|
||||
//ui管理类
|
||||
UIManager umg;
|
||||
protected:
|
||||
virtual void OnNotify(Control* sender, EventArgs& args)override;//重载事件通知
|
||||
virtual void OnClose(bool& close)override;//当窗口关闭的时候
|
||||
public:
|
||||
LoginForm();
|
||||
virtual ~LoginForm();
|
||||
};
|
||||
|
||||
22
demo/QQ/main.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "loginForm.h"
|
||||
|
||||
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_In_ LPWSTR lpCmdLine,
|
||||
_In_ int nCmdShow)
|
||||
{
|
||||
//app类
|
||||
Application app(hInstance);
|
||||
app.EnableHighDpi();//启用高DPI
|
||||
app.SetResource("my_res");//设定资源名称
|
||||
|
||||
//创建登录创建
|
||||
LoginForm loginFrm;
|
||||
loginFrm.Show();
|
||||
|
||||
//loginFrm.CloseShadowBox();
|
||||
|
||||
//开始消息循环
|
||||
int code = app.Exec();
|
||||
return code;
|
||||
}
|
||||
BIN
demo/QQ/res/check.png
Normal file
|
After Width: | Height: | Size: 784 B |
BIN
demo/QQ/res/check_1.png
Normal file
|
After Width: | Height: | Size: 938 B |
BIN
demo/QQ/res/close.png
Normal file
|
After Width: | Height: | Size: 496 B |
BIN
demo/QQ/res/down.png
Normal file
|
After Width: | Height: | Size: 510 B |
BIN
demo/QQ/res/gif2.gif
Normal file
|
After Width: | Height: | Size: 3.6 MiB |
BIN
demo/QQ/res/head.png
Normal file
|
After Width: | Height: | Size: 772 KiB |
86
demo/QQ/res/loginForm.htm
Normal file
@@ -0,0 +1,86 @@
|
||||
<vbox id="mainLayout" action="move">
|
||||
|
||||
<hbox height="20" margin-top="5" action="move">
|
||||
<spacer></spacer>
|
||||
<label size="20,20" style="background-image: url(res/setting.png)"></label>
|
||||
<spacer width="10"></spacer>
|
||||
<label id="btnExit" size="20,20" action="close" style="background-image: url(res/close.png)"></label>
|
||||
<spacer width="10"></spacer>
|
||||
</hbox>
|
||||
|
||||
<!--<spacer height="40"></spacer>-->
|
||||
<label margin-top="30" id="headImg" size="80,80" action="move"></label>
|
||||
|
||||
<!-- 账号输入框 -->
|
||||
<hbox margin-top="25" size="258,42" style="border-radius:5px;background-color:white;">
|
||||
<spacer width="24"></spacer>
|
||||
<input id="user" halign="center" placeholder="输入QQ号" />
|
||||
<label size="24,24" margin-right="5" style="background-image:url(res/down.png)"></label>
|
||||
</hbox>
|
||||
|
||||
<!-- 密码输入框 -->
|
||||
<hbox margin-top="10" size="258,42" style="border-radius:5px;background-color:white;">
|
||||
<spacer width="24"></spacer>
|
||||
<input passwordchar="*" id="pwd" halign="center" placeholder="输入密码" />
|
||||
<label size="15,15" margin-right="10" style="background-image:url(res/close.png)"></label>
|
||||
</hbox>
|
||||
|
||||
<!-- 协议勾选 -->
|
||||
<hbox size="258,42" margin-top="10" style="font-size:12px">
|
||||
<checkbox size="18,18" id="ckbox"></checkbox>
|
||||
<label width="auto" text="我已阅读并同意"></label>
|
||||
<button url="www.baidu.com" width="auto" style="color: #2D77E5;cursor:pointer" text="服务协议"></button>
|
||||
<label width="auto" text="和"></label>
|
||||
<button url="www.bing.com" width="auto" style="color: #2D77E5" text="QQ隐私保护指引"></button>
|
||||
</hbox>
|
||||
|
||||
<button margin-top="15" size="258,38" id="btnLogin" text="登录"> </button>
|
||||
|
||||
|
||||
<!-- 扫码登陆/更多选项 -->
|
||||
<hbox size="258,20" margin-top="40" style="font-size:14px">
|
||||
|
||||
<spacer></spacer>
|
||||
|
||||
<button width="auto" text="扫码登录" style="color: #2D77E5 "></button>
|
||||
|
||||
<label width="auto" text="|" margin="0,5,0,5" style="color: #E4DFEB"></label>
|
||||
|
||||
<button width="auto" text="更多选项" style="color: #2D77E5 "></button>
|
||||
|
||||
<spacer></spacer>
|
||||
|
||||
</hbox>
|
||||
|
||||
</vbox>
|
||||
|
||||
<style>
|
||||
#mainLayout {
|
||||
background-color: #E8F0FF;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#headImg {
|
||||
background-image: url(res/head.png);
|
||||
border-radius: 80px;
|
||||
border: 2px solid white;
|
||||
}
|
||||
|
||||
#ckbox {
|
||||
background-image: url(res/check.png);
|
||||
}
|
||||
|
||||
#ckbox:checked {
|
||||
background-image: url(res/check_1.png);
|
||||
}
|
||||
|
||||
#btnLogin {
|
||||
background-color: #0099FF;
|
||||
color: white;
|
||||
border-radius: 8px;
|
||||
}
|
||||
/*登录按钮鼠标悬浮时候的外观*/
|
||||
#btnLogin:hover {
|
||||
background-color: #008DEB;
|
||||
}
|
||||
</style>
|
||||
BIN
demo/QQ/res/setting.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |