Ai
1 Star 0 Fork 0

Janisa/GUI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ProgressBar.h 1.74 KB
一键复制 编辑 原始数据 按行查看 历史
Janisa 提交于 2024-07-09 19:24 +08:00 . 添加编译工程脚本
#pragma once
#include "ControlBase.h"
class ProgressBar : public Control
{
public:
virtual UIClass Type() { return UIClass::UI_ProgressBar; }
bool IsContainer() override
{
return false;
}
float Boder = 1.5f;
float PercentageValue = 0.5f;
ProgressBar(int x, int y, int width = 120, int height = 24)
{
this->Location = POINT{x, y};
this->Size = SIZE{width, height};
this->BackColor = Colors::LightYellow4;
this->ForeColor = Colors::LawnGreen;
}
void Update() override
{
if (this->IsVisual == false)
return;
auto d2d = this->Render;
bool isUnderMouse = this->MostParent->UnderMouse == this;
bool isSelected = this->MostParent->Selected == this;
auto abslocation = this->AbsLocation;
auto size = this->ActualSize();
auto absRect = this->AbsRect;
d2d->PushDrawRect(absRect.left, absRect.top, absRect.right - absRect.left, absRect.bottom - absRect.top);
{
Control *tmpc = this;
List<Control *> need_render_background;
while (tmpc->BackColor.a < 1.0f)
{
tmpc = tmpc->Parent;
need_render_background.Add(tmpc);
}
if (this->BackColor.a < 1.0f)
{
for (int i = need_render_background.Count - 1; i >= 0; i--)
{
d2d->FillRect(abslocation.x, abslocation.y, size.cx, size.cy, need_render_background[i]->BackColor);
if (need_render_background[i]->Image)
{
need_render_background[i]->RenderImage();
}
}
}
d2d->FillRect(abslocation.x, abslocation.y, size.cx, size.cy, this->BackColor);
if (this->Image)
{
this->RenderImage();
}
d2d->FillRect(abslocation.x, abslocation.y, size.cx * this->PercentageValue, size.cy, this->ForeColor);
// d2d->DrawRect(abslocation.x, abslocation.y, size.cx, size.cy, this->BolderColor, this->Boder);
}
d2d->PopDrawRect();
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/Janisa/gui.git
git@gitee.com:Janisa/gui.git
Janisa
gui
GUI
master

搜索帮助