unit FlatPageControl1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls;
type
TFlatPageControl1 =
class(TPageControl)
private
FFlat: Boolean;
procedure SetFlat(
const Value: Boolean);
protected
procedure WMPaint(
var Msg: TWMPaint);
message WM_PAINT;
public
constructor Create(Owner: TComponent);
override;
published
property Flat: Boolean
read FFlat
write SetFlat;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Zusätzlich', [TFlatPageControl1]);
end;
constructor TFlatPageControl1.Create(Owner: TComponent);
begin
inherited;
FFlat := False;
end;
procedure TFlatPageControl1.SetFlat(
const Value: Boolean);
begin
if FFlat <> Value
then
begin
FFlat := Value;
Repaint;
end;
end;
procedure TFlatPageControl1.WMPaint(
var Msg: TWMPaint);
var
R: TRect;
begin
inherited;
if FFlat
and (Style = tsTabs)
and (TabPosition = tpTop)
then
begin
R := ClientRect;
R.Top := DisplayRect.Top - 4;
Canvas.Pen.Color := clBtnFace;
Canvas.Pen.Width := 3;
Canvas.PolyLine([Point(R.Left - 1, R.Top), Point(R.Left - 1, R.Bottom)]);
Canvas.Pen.Width := 2;
Canvas.PolyLine([Point(R.Left, R.Bottom - 1), Point(R.Right - 1, R.Bottom - 1),
Point(R.Right - 1, R.Top)]);
end;
end;
end.