feat: add a new awesome feature

This commit is contained in:
2025-11-04 16:48:53 +08:00
parent 8dee285de8
commit 7b087e296a
22 changed files with 210 additions and 58 deletions
+18 -2
View File
@@ -69,7 +69,14 @@ void Window::draw(std::string imagePath)
hWnd = initgraph(width, height, windowMode);
SetWindowText(hWnd, headline.c_str());
loadimage(background, imagePath.c_str(), width, height, true);
putimage(0, 0, background);
if(background)
putimage(0, 0, background);
else
{
// 设置背景色并清屏
setbkcolor(wBkcolor);
cleardevice();
}
// 同样应用可拉伸样式
LONG style = GetWindowLong(hWnd, GWL_STYLE);
style |= WS_THICKFRAME | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;
@@ -78,7 +85,11 @@ void Window::draw(std::string imagePath)
// 绘制控件(含对话框)到窗口
BeginBatchDraw();
for (auto& control : controls) control->draw();
for (auto& control : controls)
{
control->setDirty(true);
control->draw();
}
for (auto& dlg : dialogs) dlg->draw();
EndBatchDraw();
}
@@ -328,6 +339,11 @@ IMAGE* Window::getBkImage() const
return this->background;
}
std::string Window::getBkImageFile() const
{
return this->bkImageFile;
}
std::vector<std::unique_ptr<Control>>& Window::getControls()
{
return this->controls;