unit Unit101;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm101 =
class(TForm)
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
procedure WMCTLColor(
var msg: TWMCtlColorStatic);
message WM_CTLCOLORSTATIC;
public
{ Public-Deklarationen }
end;
var
Form101: TForm101;
implementation
{$R *.dfm}
uses
UxTheme;
{ TForm101 }
procedure TForm101.FormCreate(Sender: TObject);
var
CheckBox3: TCheckBox;
begin
SetWindowTheme(CheckBox2.Handle, '
', '
');
CheckBox3 := TCheckBox.Create(Self);
CheckBox3.Parent := Self;
CheckBox3.Caption := '
CheckBox3';
CheckBox3.Tag := 1;
CheckBox3.
Name := '
CheckBox3';
SetWindowTheme(CheckBox3.Handle, '
', '
');
end;
procedure TForm101.WMCTLColor(
var msg: TWMCtlColorStatic);
var
sCompText:
array[0..255]
of Char;
Comp: TComponent;
CheckBox: TCheckBox;
begin
inherited ;
//if msg.ChildWnd=CheckBox2.Handle then
begin
SendMessage(msg.ChildWnd, WM_GETTEXT, SizeOf(sCompText), Integer(@sCompText[0]));
if sCompText<>'
'
then
begin
Comp := FindComponent(sCompText);
if Comp<>
nil then
begin
if Comp
is TCheckBox
then
begin
CheckBox := TCheckBox(Comp);
if CheckBox.Tag=1
then
begin
SetTextColor(Msg.ChildDC,clRed);
end;
end;
end;
end;
end;
end;
end.