Delphi のPageControl のタブの色をページごとに変えるにはどうしたらいいですか
OwnerDraw を true にして、こんな感じ
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
begin
with Control.Canvas do begin
case TabIndex of
0:Brush.Color := clAqua;
1:Brush.Color := clLime;
2:Brush.Color := clFuchsia;
else
Brush.Color := clGray;
end;
if Active then Brush.Color := clYellow;
FillRect(Rect);
TextOut(Rect.Left+4,Rect.Top+4,PageControl1.Pages[TabIndex].Caption);
end;
end;
ありがとうございます。
さっそく、試してみましたが
イベント OnDrawTab をクリックしてコーディングしてみました。
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
に飛ばないようなのですが、何か設定しなけらばならないのでょか?
すみませんがよろしくお願いします
> OwnerDraw を true にして
これしましたか?
どうもありがとうございました。
色が変わりました。
ツイート | ![]() |