⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expanel.pas

📁 Delphi, typed list generator code snippled, wonderfull delphi sample code
💻 PAS
字号:
unit Expanel;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, ExtCtrls;

type
  TExPanel = class(TPanel)
  private
    { Private-Deklarationen }
    FSpacingLeft: Integer;
    FSpacingTop: Integer;
    FSpacingRight: Integer;
    FSpacingBottom: Integer;

    Procedure SetSpacingLeft( value: Integer );
    Procedure SetSpacingTop( value: Integer );
    Procedure SetSpacingRight( value: Integer );
    Procedure SetSpacingBottom( value: Integer );
  protected
    { Protected-Deklarationen }
    procedure AlignControls(AControl: TControl; var Rect: TRect); override;
  public
    { Public-Deklarationen }
    constructor Create(AOwner: TComponent); override;
  published
    { Published-Deklarationen }
    property SpacingLeft:Integer read FSpacingLeft write SetSpacingLeft default 8;
    property SpacingTop:Integer read FSpacingTop write SetSpacingTop default 8;
    property SpacingRight:Integer read FSpacingRight write SetSpacingRight default 8;
    property SpacingBottom:Integer read FSpacingBottom write SetSpacingBottom default 8;
  end;

procedure Register;

implementation

constructor TExPanel.Create(AOwner: TComponent);
  Begin
    inherited Create( aOwner );
    FSpacingLeft := 8;
    FSpacingTop := 8;
    FSpacingRight := 8;
    FSpacingBottom := 8;
    ControlStyle := ControlStyle - [csSetCaption];
  End;

Procedure TExPanel.SetSpacingLeft( value: Integer );
  Begin
    If FSpacingLeft <> value Then Begin
      FSpacingLeft := value;
      Realign;
      Invalidate;
    End;
  End;

Procedure TExPanel.SetSpacingTop( value: Integer );
  Begin
    If FSpacingTop <> value Then Begin
      FSpacingTop := value;
      Realign;
      Invalidate;
    End;
  End;

Procedure TExPanel.SetSpacingRight( value: Integer );
  Begin
    If FSpacingRight <> value Then Begin
      FSpacingRight := value;
      Realign;
      Invalidate;
    End;
  End;

Procedure TExPanel.SetSpacingBottom( value: Integer );
  Begin
    If FSpacingBottom <> value Then Begin
      FSpacingBottom := value;
      Realign;
      Invalidate;
    End;
  End;

procedure TExPanel.AlignControls(AControl: TControl; var Rect: TRect);
 Begin
   With Rect Do Begin
     Left := Left + FSpacingLeft;
     Top  := Top + FSpacingTop;
     Right := Right - FSpacingRight;
     Bottom := Bottom - FSpacingBottom;
   End;
   inherited AlignControls( AControl, Rect );
 End;

procedure Register;
begin
  RegisterComponents('PBGoodies', [TExPanel]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -