Is there a way to change the color of a Tabsheet ?
Thank you
"Serra" <se...@serra.com> wrote in message
news:481d6715$1...@newsgroups.borland.com...
> D7
>
> Is there a way to change the color of a Tabsheet ?
>
> Thank you
http://www.delphipages.com/threads/thread.cfm?ID=49055&G=49032
> D7
>
> Is there a way to change the color of a Tabsheet ?
Here is an older post on this theme:
<quote>
> Can anyone tell me how to change the color of a tabsheet?
>
Dennis,
here is an example. It uses a so-called interposer class to change the
behaviour of the stock TTabsheet class, since it is a wee bit difficult
to get the page control to use a custom tabsheet class in the designer.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls, ComCtrls;
type
TTabsheet = class( ComCtrls.TTabSheet )
private
FColor: TColor;
Procedure SetColor( value: TColor );
Procedure WMEraseBkGnd( var msg: TWMEraseBkGnd );
message WM_ERASEBKGND;
public
Constructor Create( aOwner: TComponent ); override;
property Color: TColor read FColor write SetColor;
end;
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TTabsheet }
constructor TTabsheet.Create(aOwner: TComponent);
begin
inherited;
FColor := clBtnFace;
end;
procedure TTabsheet.SetColor(value: TColor);
begin
If FColor <> value Then Begin
FColor := value;
Invalidate;
End;
end;
procedure TTabsheet.WMEraseBkGnd(var msg: TWMEraseBkGnd);
begin
If FColor = clBtnFace Then
inherited
Else Begin
Brush.Color := FColor;
Windows.FillRect( msg.dc, Clientrect, Brush.handle );
msg.result := 1;
End;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Tabsheet1.color := clYellow;
TabSheet2.color := clLime;
end;
end.
</quote>
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com