C++编译器RAD Studio XE7更改面板的颜色
C++ Builder RAD Studio XE7 change color of a Panel
按下按钮后,我想将面板的颜色更改为绿色:
ErrorDetectorPanel->Brush->Color = clLime;
不起作用。
ErrorDetectorPanel->Color = clLime;
ErrorDetectorPanel->Refresh();
不起作用。
有这种瘾:
ErrorDetectorPanel->ParentColor = false;
ErrorDetectorPanel->Refresh();
它仍然不起作用。
试着这样做:
HBRUSH brush = CreateSolidBrush(RGB(0, 255, 0));
SetWindowLong(ErrorDetectorPanel->Handle,WM_ERASEBKGND, 0);
SetWindowLong(ErrorDetectorPanel->Handle,GCLP_HBRBACKGROUND, (LONG)brush);
TForm透明度为false按下按钮后得到相同的结果。
我该怎么做才对?
设置TPanel.Color
属性是正确的解决方案(它会自动将ParentColor
设置为false),但是您必须禁用TPanel
(或整个程序)上的主题化/样式化才能使用自定义着色。主题/样式控件从活动主题/样式中获取颜色。
我使用
TPanel *tp[]={Panel454,Panel455,Panel456};
for(int i=sizeof(tp)/sizeof(tp[0]);--i>=0;){
tp[i]->ParentBackground=false;
tp[i]->StyleElements = TStyleElements(); // disable all
// tp[i]->CleanupInstance();
tp[i]->Color=clSkyBlue;
}
如果使用了主题化/样式化控件。
相关文章:
- C/C++编译器通常会删除重复的库吗
- 模板-模板参数推导:三个不同的编译器三种不同的行为
- Win32编译器选项和内存分配
- MSVC多行宏编译器错误
- 静态数据成员的问题-修复链接错误会导致编译器错误
- 将"打开的CV图像"中的"颜色"转换为整数格式
- C++,我收到一个无法理解的编译器错误
- 在线编译器中的分段C++没有打印消息
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- C/C++预处理器是否可以检测一些编译器选项
- 是否有C++编译器选项允许激进地删除所有函数调用,并将参数传递给具有空体的函数
- 如何在内核C++中使用1920x1080x16M图形或类似的16M颜色?(VGA)
- 如何在24位SDL_Surface上设置像素的颜色
- C++错误C2600:无法定义编译器生成的特殊成员函数(必须首先在类中声明)
- 我需要知道编译器如何在cpp中使用析构函数
- 编译器如何区分std::vector的构造函数
- CLANG 编译器 说:变量"PTR"可能未初始化
- 告诉c++编译器该参数没有别名
- C++编译器,形状,如何在鼠标输入上更改颜色
- C++编译器RAD Studio XE7更改面板的颜色