Einzelnen Beitrag anzeigen

hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#1

TCheckBox.Color über WM_CTLCOLOR

  Alt 2. Aug 2016, 07:43
Hallo,
das CheckBox.Color keine Wirkung hat, ist ja bekannt.

Lösung 1: andere Komponente
Lösung 2: CheckBox ohne Caption + Label davor
Lösung 3: WM_CTLCOLOR überschreiben

Lösung 3 klappt bei mir irgendwie nicht

Die Methode wird gar nicht aufgerufen!
Ich bin mir sicher, dass ich das schon mal geschafft hatte.

Weiss jemand Rat?


Delphi-Quellcode:
unit Unit101;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm101 = class(TForm)
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
  private
    { Private-Deklarationen }
    procedure WMCTLColor(var msg: TWMCtlColor); message WM_CTLCOLOR;
  public
    { Public-Deklarationen }
  end;

var
  Form101: TForm101;

implementation

{$R *.dfm}

{ TForm101 }

procedure TForm101.WMCTLColor(var msg: TWMCtlColor);
begin
  inherited ;

  //SetTextColor(Msg.wParam,RGB(0,$80,0));
  //Exit;


  if msg.ChildWnd=CheckBox2.Handle then
  begin
    msg.Result := CreateSolidBrush(RGB(255, 255, 0));
  end;
  
end;

end.
Heiko
  Mit Zitat antworten Zitat