0

After pushing a button I wanted to change the color of a panel to green:

ErrorDetectorPanel->Brush->Color = clLime;

doesn´t work.

ErrorDetectorPanel->Color = clLime;
ErrorDetectorPanel->Refresh();

doesn´t work.

with this addiction:

ErrorDetectorPanel->ParentColor = false;
ErrorDetectorPanel->Refresh();

it still doesn´t work.

tried it this way:

HBRUSH brush = CreateSolidBrush(RGB(0, 255, 0));
SetWindowLong(ErrorDetectorPanel->Handle,WM_ERASEBKGND, 0);
SetWindowLong(ErrorDetectorPanel->Handle,GCLP_HBRBACKGROUND, (LONG)brush);

TForm transparency is false same result after pushing the button.

How can I do it right?

4

2 に答える 2

3

プロパティを設定するのTPanel.Colorが正しい解決策ですが (自動的に false に設定されます)、カスタム カラーリングを使用するには、(またはプログラム全体で)ParentColorテーマ/スタイリングを無効にする必要があります。TPanelテーマ/スタイル コントロールは、アクティブなテーマ/スタイルから色を取得します。

于 2015-11-25T02:59:20.563 に答える