diff --git a/.gitignore b/.gitignore index 76521f4..831c33f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,10 @@ /_temp /_bin /lib -/temp -/bin /.vs +/.vscode *.db *.gitignore *.gitattributes -*.tlog \ No newline at end of file +*.exe +*.pdb \ No newline at end of file diff --git a/demoEx/Adminstor/Adminstor.sln b/demoEx/Adminstor/Adminstor.sln new file mode 100644 index 0000000..e57994d --- /dev/null +++ b/demoEx/Adminstor/Adminstor.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36811.4 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Adminstor", "Adminstor\Adminstor.vcxproj", "{EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Debug|x64.ActiveCfg = Debug|x64 + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Debug|x64.Build.0 = Debug|x64 + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Debug|x86.ActiveCfg = Debug|Win32 + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Debug|x86.Build.0 = Debug|Win32 + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Release|x64.ActiveCfg = Release|x64 + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Release|x64.Build.0 = Release|x64 + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Release|x86.ActiveCfg = Release|Win32 + {EE06DEDC-52B5-4B5D-8B52-7FEB02D77E6B}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AC1EAB6C-7DC1-484D-92AE-6736232936CA} + EndGlobalSection +EndGlobal diff --git a/demoEx/Adminstor/Adminstor/Adminstor.vcxproj b/demoEx/Adminstor/Adminstor/Adminstor.vcxproj new file mode 100644 index 0000000..23b0de5 --- /dev/null +++ b/demoEx/Adminstor/Adminstor/Adminstor.vcxproj @@ -0,0 +1,203 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {ee06dedc-52b5-4b5d-8b52-7feb02d77e6b} + Adminstor + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + ..\_bin\ + ..\_temp\$(Platform)$(Configuration)$(ProjectName)\ + ..\..\..\include;$(IncludePath) + ..\..\..\lib;$(LibraryPath) + $(ProjectName)_$(Configuration)_$(Platform) + + + ..\_bin\ + ..\_temp\$(Platform)$(Configuration)$(ProjectName)\ + ..\..\..\include;$(IncludePath) + ..\..\..\lib;$(LibraryPath) + $(ProjectName)_$(Configuration)_$(Platform) + + + ..\_bin\ + ..\_temp\$(Platform)$(Configuration)$(ProjectName)\ + ..\..\..\include;$(IncludePath) + ..\..\..\lib;$(LibraryPath) + $(ProjectName)_$(Configuration)_$(Platform) + + + ..\_bin\ + ..\_temp\$(Platform)$(Configuration)$(ProjectName)\ + ..\..\..\include;$(IncludePath) + ..\..\..\lib;$(LibraryPath) + $(ProjectName)_$(Configuration)_$(Platform) + + + + Level3 + true + + + true + stdcpp17 + MultiThreadedDebug + Use + pch.h + + + Windows + true + EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + + + true + stdcpp17 + MultiThreaded + Use + pch.h + + + Windows + false + EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies) + + + + + Level3 + true + + + true + stdcpp17 + MultiThreadedDebug + Use + pch.h + + + Windows + true + EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + + + true + stdcpp17 + MultiThreaded + Use + pch.h + + + Windows + false + EzUI_$(Configuration)_$(Platform).lib;%(AdditionalDependencies) + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + \ No newline at end of file diff --git a/demoEx/Adminstor/Adminstor/Adminstor.vcxproj.filters b/demoEx/Adminstor/Adminstor/Adminstor.vcxproj.filters new file mode 100644 index 0000000..336983d --- /dev/null +++ b/demoEx/Adminstor/Adminstor/Adminstor.vcxproj.filters @@ -0,0 +1,55 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + + + 源文件 + + + 源文件 + + + 源文件 + + + + + 资源文件 + + + 资源文件 + + + + + 资源文件 + + + \ No newline at end of file diff --git a/demoEx/Adminstor/Adminstor/Adminstor.vcxproj.user b/demoEx/Adminstor/Adminstor/Adminstor.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/demoEx/Adminstor/Adminstor/Adminstor.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/demoEx/Adminstor/Adminstor/DemoUi.aps b/demoEx/Adminstor/Adminstor/DemoUi.aps new file mode 100644 index 0000000..af2d2b8 Binary files /dev/null and b/demoEx/Adminstor/Adminstor/DemoUi.aps differ diff --git a/demoEx/Adminstor/Adminstor/DemoUi.ico b/demoEx/Adminstor/Adminstor/DemoUi.ico new file mode 100644 index 0000000..b3ec03b Binary files /dev/null and b/demoEx/Adminstor/Adminstor/DemoUi.ico differ diff --git a/demoEx/Adminstor/Adminstor/DemoUi.rc b/demoEx/Adminstor/Adminstor/DemoUi.rc new file mode 100644 index 0000000..aef1129 Binary files /dev/null and b/demoEx/Adminstor/Adminstor/DemoUi.rc differ diff --git a/demoEx/Adminstor/Adminstor/Main.cpp b/demoEx/Adminstor/Adminstor/Main.cpp new file mode 100644 index 0000000..2945f89 --- /dev/null +++ b/demoEx/Adminstor/Adminstor/Main.cpp @@ -0,0 +1,15 @@ +#include "pch.h" +#include "mainForm.h" + +int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) +{ + //app类 + Application app(hInstance); + app.EnableHighDpi();//启用高DPI + + //创建 + mainForm nainFrm; + nainFrm.Show(); + + return app.Exec();//进行消息循环 +} \ No newline at end of file diff --git a/demoEx/Adminstor/Adminstor/Resource.h b/demoEx/Adminstor/Adminstor/Resource.h new file mode 100644 index 0000000..1b03dee --- /dev/null +++ b/demoEx/Adminstor/Adminstor/Resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ 生成的包含文件。 +// 供 DemoUi.rc 使用 +// +#define IDI_SMALL 101 +#define IDD_INPUT 102 +#define IDC_EDIT1 1000 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/demoEx/Adminstor/Adminstor/framework.h b/demoEx/Adminstor/Adminstor/framework.h new file mode 100644 index 0000000..c420462 --- /dev/null +++ b/demoEx/Adminstor/Adminstor/framework.h @@ -0,0 +1,21 @@ +#pragma once +#include "resource.h" + +#include + +#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/Animation.h" + diff --git a/demoEx/Adminstor/Adminstor/mainForm.cpp b/demoEx/Adminstor/Adminstor/mainForm.cpp new file mode 100644 index 0000000..920fbec --- /dev/null +++ b/demoEx/Adminstor/Adminstor/mainForm.cpp @@ -0,0 +1,133 @@ +#include "pch.h" +#include "mainForm.h" + +void mainForm::OnNotify(Control* sender, EventArgs& args) +{ + UIString btnName = sender->Name; // 控件id + Event eventType = args.EventType; // 事件类型 + + switch (eventType) + { + case ezui::OnMouseDown: //鼠标按下 + { + if (btnName == "btnExitMain") { //退出 + int result = ::MessageBoxW(Hwnd(), L"要退出程序吗?", L"提示", MB_YESNO | MB_ICONQUESTION); + if (result == IDYES) + exit(0); + } + else if (btnName == "btnMinMain") { //最小化 + this->ShowMinimized(); + } + else if (btnName == "btnMaxMain") { //最大化|还原 + if (this->IsMaximized()) { + this->ShowNormal(); + // 修改控件文字 + Button* btnMax = (Button*)FindControl("btnMaxMain"); + btnMax->SetText(L"🗖"); + } + else { + this->ShowMaximized(); + // 修改控件文字 + Button* btnMax = (Button*)FindControl("btnMaxMain"); + btnMax->SetText(L"🗗"); + } + } + else if (btnName == "btnAdmin") { //到管理页面 获取 mainTab ,设置页面为0 + TabLayout* mainTab = (TabLayout*)FindControl("mainTab"); + mainTab->SetPageIndex(0); + mainTab->Invalidate(); + } + else if (btnName == "btnTools") { //到工具页面 获取 mainTab ,设置页面为1 + TabLayout* mainTab = (TabLayout*)FindControl("mainTab"); + mainTab->SetPageIndex(1); + mainTab->Invalidate(); + } + else if (btnName == "btnAdminConnect") { //管理页面的连接按钮按下,先获取 btnAdminConnect 按钮,设置为不可用,修改文字为“连接中...” + Button* btnAdminConnect = (Button*)FindControl("btnAdminConnect"); + btnAdminConnect->SetText(L"🔄"); + btnAdminConnect->Style.BackColor = Color(0, 185, 107); + } + else if (btnName == "btnAdminTemp") { //管理页面的测试按钮 + TextBox* textAdmin = (TextBox*)FindControl("textAdminOutput"); //获取输出框 + //textAdmin->Insert(L"\n测试成功!", true); + if (textAdmin) { + textAdmin->Insert(L"\n测试成功!",true); + } + } + } + break; + case ezui::OnMouseDoubleClick: //鼠标双击 + { + + } + break; + default: + break; + } + if (args.EventType == Event::OnMouseDown) { + + + } + __super::OnNotify(sender, args); +} + +void mainForm::OnClose(bool& close) +{ + Application::Exit(); +} + +mainForm::mainForm() :LayeredWindow(1500, 750) +{ + // 如果是debug模式则创建控制台窗口用于输出调试信息 +#ifdef _DEBUG + AllocConsole(); + FILE* fp = nullptr; + freopen_s(&fp, "CONOUT$", "w", stdout); + freopen_s(&fp, "CONOUT$", "w", stderr); + std::cout << "调试模式控制台已启动!" << std::endl; +#endif + + SetResizable(true); // 启用窗口大小调整 + SetMiniSize(Size(600, 450)); // 设置最小尺寸 + umg.LoadXml("res/mainForm.htm");//加载xml里面的控件与样式 + umg.SetupUI(this); + + // 通过资源ID加载图标 (在 app.rc 中定义 IDI_SMALL=101) + HICON hIco = (HICON)::LoadImageW(GetModuleHandleW(nullptr), MAKEINTRESOURCEW(IDI_SMALL), IMAGE_ICON, 32, 32, 0); + if (hIco) SetIcon(hIco); + + // 初始化设置表格各项属性 + TableView* tableView = (TableView*)FindControl("tableViewAdmin"); //获取表格控件 + if (tableView) { + tableView->SelectedRowBackColor = Color(200, 230, 255); // 设置选中行背景色 + //tableView->SetColumnType(5, ezui::CellType::CheckBox); + tableView->SetColumnType(0, ezui::CellType::ReadOnly); //设置第1列为只读类型 + tableView->SetColumnType(2, ezui::CellType::ComboBox); //设置第3列为下拉列表类型 + tableView->SetColumnComboItems(2, { L"禁止", L"开通" , L"验机" }); //设置第3列下拉列表内容 + tableView->SetDefaultTextAlign(Align::MiddleCenter); //设置默认对齐方式 + tableView->SetColumnTextAlign(7, Align::MiddleLeft); //设置机器码列对齐 + tableView->SetColumnTextAlign(8, Align::MiddleLeft); //设置列对齐 + tableView->SetColumnTextAlign(9, Align::MiddleLeft); //设置列对齐 + + //设置列宽 + std::vector withs = { 60, 130, 55, 95, 85, 85, 105, 70, 75, 80, 80, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95 }; + for (size_t i = 0; i < withs.size(); i++) + tableView->SetColumnWidth(i, withs[i]); + + // 单元格编辑完成(编辑结束时触发,提供旧值与新值) + tableView->CellEditFinished = [](int row, int col, const UIString& oldValue, const UIString& newValue) { + //std::cout << "完成编辑单元格内容: " << newValue.ansi() << ", " << oldValue.ansi() << std::endl; + + }; + // 单元格内容变化回调(内容变化时立即触发) + tableView->CellValueChanged = [](int row, int col, const UIString& newValue) { + std::cout << "单元格内容变化回调: " << newValue.ansi() << std::endl; + + }; + } + +} + +mainForm::~mainForm() +{ +} diff --git a/demoEx/Adminstor/Adminstor/mainForm.h b/demoEx/Adminstor/Adminstor/mainForm.h new file mode 100644 index 0000000..ca6af80 --- /dev/null +++ b/demoEx/Adminstor/Adminstor/mainForm.h @@ -0,0 +1,20 @@ +#pragma once +#include "pch.h" + +using namespace ezui; + + +// 主窗口 +class mainForm :public LayeredWindow +{ +private: + //ui管理类 + UIManager umg; +protected: + virtual void OnNotify(Control* sender, EventArgs& args)override;//重载事件通知 + virtual void OnClose(bool& close)override;//当窗口关闭的时候 +public: + mainForm(); + virtual ~mainForm(); +}; + diff --git a/demoEx/Adminstor/Adminstor/pch.cpp b/demoEx/Adminstor/Adminstor/pch.cpp new file mode 100644 index 0000000..331e647 --- /dev/null +++ b/demoEx/Adminstor/Adminstor/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" \ No newline at end of file diff --git a/demoEx/Adminstor/Adminstor/pch.h b/demoEx/Adminstor/Adminstor/pch.h new file mode 100644 index 0000000..bfcd21d --- /dev/null +++ b/demoEx/Adminstor/Adminstor/pch.h @@ -0,0 +1,2 @@ +#pragma once +#include "framework.h" diff --git a/demoEx/Adminstor/Adminstor/small.ico b/demoEx/Adminstor/Adminstor/small.ico new file mode 100644 index 0000000..b3ec03b Binary files /dev/null and b/demoEx/Adminstor/Adminstor/small.ico differ diff --git a/demoEx/Adminstor/_bin/res/check.png b/demoEx/Adminstor/_bin/res/check.png new file mode 100644 index 0000000..9578d7b Binary files /dev/null and b/demoEx/Adminstor/_bin/res/check.png differ diff --git a/demoEx/Adminstor/_bin/res/check_1.png b/demoEx/Adminstor/_bin/res/check_1.png new file mode 100644 index 0000000..7a38407 Binary files /dev/null and b/demoEx/Adminstor/_bin/res/check_1.png differ diff --git a/demoEx/Adminstor/_bin/res/close.png b/demoEx/Adminstor/_bin/res/close.png new file mode 100644 index 0000000..733acf0 Binary files /dev/null and b/demoEx/Adminstor/_bin/res/close.png differ diff --git a/demoEx/Adminstor/_bin/res/close1.png b/demoEx/Adminstor/_bin/res/close1.png new file mode 100644 index 0000000..d874511 Binary files /dev/null and b/demoEx/Adminstor/_bin/res/close1.png differ diff --git a/demoEx/Adminstor/_bin/res/close2.png b/demoEx/Adminstor/_bin/res/close2.png new file mode 100644 index 0000000..1cd3724 Binary files /dev/null and b/demoEx/Adminstor/_bin/res/close2.png differ diff --git a/demoEx/Adminstor/_bin/res/close3.png b/demoEx/Adminstor/_bin/res/close3.png new file mode 100644 index 0000000..4d85a00 Binary files /dev/null and b/demoEx/Adminstor/_bin/res/close3.png differ diff --git a/demoEx/Adminstor/_bin/res/down.png b/demoEx/Adminstor/_bin/res/down.png new file mode 100644 index 0000000..2df7f84 Binary files /dev/null and b/demoEx/Adminstor/_bin/res/down.png differ diff --git a/demoEx/Adminstor/_bin/res/head.png b/demoEx/Adminstor/_bin/res/head.png new file mode 100644 index 0000000..61593ea Binary files /dev/null and b/demoEx/Adminstor/_bin/res/head.png differ diff --git a/demoEx/Adminstor/_bin/res/loginForm.htm b/demoEx/Adminstor/_bin/res/loginForm.htm new file mode 100644 index 0000000..bb59433 --- /dev/null +++ b/demoEx/Adminstor/_bin/res/loginForm.htm @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demoEx/Adminstor/_bin/res/mainForm.htm b/demoEx/Adminstor/_bin/res/mainForm.htm new file mode 100644 index 0000000..206c17c --- /dev/null +++ b/demoEx/Adminstor/_bin/res/mainForm.htm @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +