39 lines
854 B
C++
39 lines
854 B
C++
#pragma once
|
||
// 只读的Edit,代替Static显示文本,方便设置背景色
|
||
class CBCGPEditReadOnly
|
||
: public CBCGPEdit
|
||
{
|
||
public:
|
||
COLORREF defBkColor; // Edit的默认背景色
|
||
|
||
// 根据告警基本设置背景色.
|
||
// 0:正常,1:警告,2:错误
|
||
void setWarinLevel(uint32_t level) {
|
||
// 获取当前颜色,相同则不设置
|
||
auto color = GetColorTheme();
|
||
switch (level)
|
||
{
|
||
case 0:
|
||
if (color.m_clrBackground != defBkColor) {
|
||
color.m_clrBackground = defBkColor;
|
||
SetColorTheme(color);
|
||
}
|
||
break;
|
||
case 1:
|
||
if (color.m_clrBackground != RGB(255, 255, 0)) {
|
||
color.m_clrBackground = RGB(255, 255, 0);
|
||
SetColorTheme(color);
|
||
}
|
||
break;
|
||
case 2:
|
||
if (color.m_clrBackground != RGB(255, 0, 0)) {
|
||
color.m_clrBackground = RGB(255, 0, 0);
|
||
SetColorTheme(color);
|
||
}
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
};
|
||
|