Einzelnen Beitrag anzeigen

FAM

Registriert seit: 22. Dez 2014
47 Beiträge
 
Delphi XE Enterprise
 
#4

AW: Eigene Komponete / Darstellungsfehler?!

  Alt 22. Dez 2014, 12:11
Habe die Lösung gefunden.

Mit Hilfe von

Delphi-Quellcode:
    
property Header: FAMPanel read FHeader write SetHeader;
    property Content: FAMPanel read FContent write SetContent;
    property Footer: FAMPanel read FFooter write SetFooter;
und die entsprechende implementierung geht es.

Delphi-Quellcode:
unit card;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, famui;

type

  FAMCard = class(FAMPanel)
  private
    { Private-Deklarationen }
    FUnterKomponente: FAMPanel;
    FHeader: FAMPanel;
    FFooter: FAMPanel;
    FContent: FAMPanel;
    procedure SetContent(const Value: FAMPanel);
    procedure SetFooter(const Value: FAMPanel);
    procedure SetHeader(const Value: FAMPanel);
  protected
    { Protected-Deklarationen }
  public
    { Public-Deklarationen }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published-Deklarationen }
    property Header: FAMPanel read FHeader write SetHeader;
    property Content: FAMPanel read FContent write SetContent;
    property Footer: FAMPanel read FFooter write SetFooter;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('FAMUI', [FAMCard]);
end;

{ TFamGUI }

constructor FAMCard.Create(AOwner: TComponent);
begin
  inherited;

  // Default size of fam card
  self.Width := 600;
  self.Height := 400;

  // Create header of card
  FHeader := FAMPanel.Create(self);
  FHeader.Parent := self;
  FHeader.Name := 'FHeader';
  FHeader.Color := _CorporateDesign.gray;
  FHeader.Align := alTop;
  FHeader.Height := 90;
  FHeader.SetSubComponent(true);

  // Create content of card
  FContent := FAMPanel.Create(self);
  FContent.Parent := self;
  FContent.Name := 'FContent';
  FContent.Color := _CorporateDesign.white;
  FContent.Align := alclient;
  FContent.SetSubComponent(true);

  // Create footer of card
  FFooter := FAMPanel.Create(self);
  FFooter.Parent := self;
  FFooter.Name := 'FFooter';
  FFooter.Color := _CorporateDesign.gray;
  FFooter.Align := alBottom;
  FFooter.Height := 90;
  FFooter.SetSubComponent(true);

end;

destructor FAMCard.Destroy;
begin
  inherited;

end;

procedure FAMCard.SetContent(const Value: FAMPanel);
begin
  FContent := Value;
end;

procedure FAMCard.SetFooter(const Value: FAMPanel);
begin
  FFooter := Value;
end;

procedure FAMCard.SetHeader(const Value: FAMPanel);
begin
  FHeader := Value;
end;

end.
  Mit Zitat antworten Zitat