Files
GdCpp12/staticOnly/KsMFC/CBCGPEditReadOnly.h

39 lines
854 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#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;
}
}
};