优化前备份
This commit is contained in:
Binary file not shown.
@@ -2,16 +2,6 @@
|
||||
// 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
|
||||
|
||||
@@ -50,6 +50,10 @@ loginForm::loginForm() :LayeredWindow(320, 448)
|
||||
{
|
||||
umg.LoadXml("res/loginForm.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);
|
||||
}
|
||||
|
||||
loginForm::~loginForm()
|
||||
|
||||
@@ -105,10 +105,6 @@ void mainForm::OnNotify(Control* sender, EventArgs& args)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (args.EventType == Event::OnMouseDown) {
|
||||
|
||||
|
||||
}
|
||||
__super::OnNotify(sender, args);
|
||||
}
|
||||
@@ -118,6 +114,27 @@ void mainForm::OnClose(bool& close)
|
||||
Application::Exit();
|
||||
}
|
||||
|
||||
void mainForm::OnMouseUp(ezui::MouseButton mbtn, const ezui::Point& point)
|
||||
{
|
||||
if (mbtn == ezui::MouseButton::Right) {
|
||||
// 右键弹起处理(可实现右键单击)
|
||||
TableView* tableView = (TableView*)FindControl("tableViewAdmin"); //获取表格控件
|
||||
if (tableView) {
|
||||
//表格
|
||||
int pRow = tableView->GetHoverRow(); //当前行号
|
||||
int pCol = tableView->GetHoverCol(); //当前列号
|
||||
if (pRow < 0 || pCol < 0) return; // 说明不在表格区域内
|
||||
|
||||
UIString celContent = tableView->GetData(pRow, pCol);
|
||||
//std::cout << "单元格内容: " << celContent.ansi() << std::endl;
|
||||
std::cout << "行列号为 (" << pRow << ", " << pCol << ") 当前列宽: " << tableView->GetColumnWidth(pCol) << std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
ezui::Window::OnMouseUp(mbtn, point);
|
||||
}
|
||||
|
||||
// UI初始化
|
||||
mainForm::mainForm() :LayeredWindow(1500, 750)
|
||||
{
|
||||
SetResizable(true); // 启用窗口大小调整
|
||||
@@ -125,6 +142,10 @@ mainForm::mainForm() :LayeredWindow(1500, 750)
|
||||
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);
|
||||
|
||||
// 如果是debug模式则创建控制台窗口用于输出调试信息
|
||||
#ifdef _DEBUG
|
||||
AllocConsole();
|
||||
@@ -134,7 +155,6 @@ mainForm::mainForm() :LayeredWindow(1500, 750)
|
||||
std::cout << "调试模式控制台已启动!" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
// 初始化设置表格各项属性
|
||||
TableView* tableView = (TableView*)FindControl("tableViewAdmin"); //获取表格控件
|
||||
if (tableView) {
|
||||
@@ -149,18 +169,9 @@ mainForm::mainForm() :LayeredWindow(1500, 750)
|
||||
for(int i = 0; i < withs.size(); i++)
|
||||
tableView->SetColumnWidth(i, withs[i]);
|
||||
|
||||
// 鼠标右键单击的回调
|
||||
tableView->RightClick = [tableView](int row, int col) {
|
||||
int pRow = tableView->GetHoverRow(); //当前行号
|
||||
int pCol = tableView->GetHoverCol(); //当前列号
|
||||
UIString celContent = tableView->GetData(pRow, pCol);
|
||||
//std::cout << "单元格内容: " << celContent.ansi() << std::endl;
|
||||
std::cout << "当前列宽: " << tableView->GetColumnWidth(pCol) << std::endl;
|
||||
};
|
||||
|
||||
// 单元格编辑完成(编辑结束时触发,提供旧值与新值)
|
||||
tableView->CellEditFinished = [](int row, int col, const UIString& oldValue, const UIString& newValue) {
|
||||
std::cout << "完成编辑单元格内容: " << newValue.ansi() << ", " << oldValue.ansi() << std::endl;
|
||||
//std::cout << "完成编辑单元格内容: " << newValue.ansi() << ", " << oldValue.ansi() << std::endl;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ private:
|
||||
protected:
|
||||
virtual void OnNotify(Control* sender, EventArgs& args)override;//重载事件通知
|
||||
virtual void OnClose(bool& close)override;//当窗口关闭的时候
|
||||
virtual void OnMouseUp(ezui::MouseButton mbtn, const ezui::Point& point) override; // 鼠标抬起
|
||||
public:
|
||||
//ui管理类
|
||||
UIManager umg;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 97 KiB |
Reference in New Issue
Block a user