Einzelnen Beitrag anzeigen

Nils_13

Registriert seit: 15. Nov 2004
2.647 Beiträge
 
#18

Re: Page Control, normales Design weg und ein Viereck hin

  Alt 29. Nov 2005, 21:21
Sry, aber:
Delphi-Quellcode:
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.
Was muss ich tun, damit die Tabs so aussehen, damit so so aussehen, wie sie aussehen sollen ? Der rest ist schon flat.
  Mit Zitat antworten Zitat