unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls;
type
TForm1 =
class(TForm)
PageControl1: TPageControl;
ButtonCreate: TButton;
Button_Color: TButton;
procedure ButtonCreateClick(Sender: TObject);
procedure Button_ColorClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
TTabSheet2 =
class(TTabSheet)
protected
procedure WMEraseBkGnd(
var Msg: TWMEraseBkGnd);
published
property Color;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TTabSheet2 }
procedure TTabSheet2.WMEraseBkGnd(
var Msg: TWMEraseBkGnd);
begin
if Color = clBtnFace
then
inherited
else
begin
Brush.Color := Color;
Windows.FillRect(Msg.dc, ClientRect, Brush.Handle);
Msg.Result := 1;
end;
end;
procedure TForm1.ButtonCreateClick(Sender: TObject);
var
tmp : TTabSheet2;
begin
tmp := TTabSheet2.Create(PageControl1);
tmp.PageControl := PageControl1;
tmp.Color := clRed;
end;
procedure TForm1.Button_ColorClick(Sender: TObject);
begin
TTabSheet2(PageControl1.ActivePage).Color := clGreen;
end;
end.