使用双窗口
This commit is contained in:
BIN
demo/QQ/QQ.APS
Normal file
BIN
demo/QQ/QQ.APS
Normal file
Binary file not shown.
195
demo/QQ/QQ.vcxproj
Normal file
195
demo/QQ/QQ.vcxproj
Normal file
@@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}</ProjectGuid>
|
||||
<RootNamespace>QQ</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>..\_bin\</OutDir>
|
||||
<IntDir>..\_temp\$(Platform)$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>..\..\lib;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)_$(Configuration)_$(Platform)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>..\_bin\</OutDir>
|
||||
<IntDir>..\_temp\$(Platform)$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>..\..\lib;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)_$(Configuration)_$(Platform)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>..\_bin\</OutDir>
|
||||
<IntDir>..\_temp\$(Platform)$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>..\..\lib;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)_$(Configuration)_$(Platform)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>..\_bin\</OutDir>
|
||||
<IntDir>..\_temp\$(Platform)$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>..\..\lib;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)_$(Configuration)_$(Platform)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>EZUI_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>EZUI_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<AdditionalDependencies>EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>EZUI_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>EZUI_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<AdditionalDependencies>EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="loginForm.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="mainForm.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="loginForm.h" />
|
||||
<ClInclude Include="mainForm.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="QQ.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\head.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
46
demo/QQ/QQ.vcxproj.filters
Normal file
46
demo/QQ/QQ.vcxproj.filters
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="loginForm.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mainForm.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="loginForm.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mainForm.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="QQ.rc">
|
||||
<Filter>资源文件</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\head.png">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
demo/QQ/QQ.vcxproj.user
Normal file
4
demo/QQ/QQ.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "loginForm.h"
|
||||
#include "loginForm.h"
|
||||
#include "mainForm.h"
|
||||
|
||||
LoginForm::LoginForm() :LayeredWindow(320, 448)
|
||||
{
|
||||
@@ -19,7 +20,10 @@ void LoginForm::OnNotify(Control* sender, EventArgs& args)
|
||||
UIString user = editUser->GetText();
|
||||
UIString pwd = editpwd->GetText();
|
||||
if (user == "718987717" && pwd == "123456") {
|
||||
::MessageBox(Hwnd(), L"登录成功!", L"提示", MB_OK);
|
||||
// 登录成功,跳转到主界面
|
||||
Hide(); // 隐藏登录窗口
|
||||
static MainForm mainForm;
|
||||
mainForm.Show(); // 显示主界面
|
||||
}
|
||||
else {
|
||||
::MessageBox(Hwnd(), L"用户名或密码错误!", L"提示", MB_OK);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "ezui/Application.h" //app类
|
||||
#include "EzUI/Window.h" //基础窗口类
|
||||
#include "EzUI/Button.h" //按钮
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "EzUI/LayeredWindow.h"//分层窗口类-可以异型透明窗口
|
||||
#include "ezui/UIManager.h"//ui管理类(使用xml生成控件)
|
||||
|
||||
#pragma comment(lib,"ezui.lib")
|
||||
using namespace ezui;
|
||||
|
||||
using Form = LayeredWindow; //支持异形透明窗口(带阴影)
|
||||
|
||||
@@ -9,7 +9,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
Application app(hInstance);
|
||||
app.EnableHighDpi();//启用高DPI
|
||||
app.SetResource("my_res");//设定资源名称
|
||||
|
||||
|
||||
//创建登录创建
|
||||
LoginForm loginFrm;
|
||||
loginFrm.Show();
|
||||
|
||||
38
demo/QQ/mainForm.cpp
Normal file
38
demo/QQ/mainForm.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "mainForm.h"
|
||||
|
||||
void MainForm::OnNotify(Control* sender, EventArgs& args)
|
||||
{
|
||||
if (args.EventType == Event::OnMouseDown) {
|
||||
if (sender->Name == "btnMin") {
|
||||
SendMessage(Hwnd(), WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||
}
|
||||
else if (sender->Name == "btnMax") {
|
||||
if (IsZoomed(Hwnd())) {
|
||||
SendMessage(Hwnd(), WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||
}
|
||||
else {
|
||||
SendMessage(Hwnd(), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
|
||||
}
|
||||
}
|
||||
else if (sender->Name == "btnClose") {
|
||||
Close();
|
||||
}
|
||||
}
|
||||
__super::OnNotify(sender, args);
|
||||
}
|
||||
|
||||
void MainForm::OnClose(bool& close)
|
||||
{
|
||||
Application::Exit();
|
||||
}
|
||||
|
||||
MainForm::MainForm() : LayeredWindow(800, 600)
|
||||
{
|
||||
SetText(L"QQ主界面");
|
||||
umg.LoadXml("res/mainForm.htm");
|
||||
umg.SetupUI(this);
|
||||
}
|
||||
|
||||
MainForm::~MainForm()
|
||||
{
|
||||
}
|
||||
35
demo/QQ/mainForm.h
Normal file
35
demo/QQ/mainForm.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#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生成控件)
|
||||
#include "EzUI/LayeredWindow.h"
|
||||
#include "EzUI/Label.h"
|
||||
#include "EzUI/VLayout.h"
|
||||
#include "EzUI/HLayout.h"
|
||||
#include "EzUI/UIManager.h"
|
||||
|
||||
using namespace ezui;
|
||||
|
||||
// 主界面
|
||||
class MainForm : public LayeredWindow
|
||||
{
|
||||
private:
|
||||
UIManager umg;
|
||||
protected:
|
||||
virtual void OnNotify(Control* sender, EventArgs& args) override;
|
||||
virtual void OnClose(bool& close) override;
|
||||
public:
|
||||
MainForm();
|
||||
virtual ~MainForm();
|
||||
};
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 772 KiB After Width: | Height: | Size: 244 KiB |
18
demo/QQ/res/mainForm.htm
Normal file
18
demo/QQ/res/mainForm.htm
Normal file
@@ -0,0 +1,18 @@
|
||||
<vlayout id="mainLayout" action="move">
|
||||
<!-- 标题栏 -->
|
||||
<hbox height="20" margin-top="5" action="move">
|
||||
<spacer></spacer>
|
||||
<!-- 退出按钮 -->
|
||||
<button id="btnExitMain" size="20,20" style="background-image: url(res/close.png)"></button>
|
||||
<spacer width="10"></spacer>
|
||||
</hbox>
|
||||
|
||||
</vlayout>
|
||||
|
||||
<style>
|
||||
#mainLayout {
|
||||
background-color: #E8F0FF;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user