Einzelnen Beitrag anzeigen

Nils_13

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

Erstellen eines eigenen Tabs mit Komponenten einbindungen

  Alt 11. Apr 2005, 15:08
Hi

Delphi-Quellcode:
type
  TExtendedTabSheet = class(ComCtrls.TTabsheet)
  constructor Create(AOwner: TComponent);
  private
    fSynEdit : TSynEdit;
 public

 published
   property SynEdit : TSynEdit read fSynEdit write fSynEdit;
 end;

{ ... }

var
  SelectedSheet : TTabSheet;

{ ... }

constructor TExtendedTabSheet.Create(AOwner: TComponent);
begin
  inherited;
  fSynEdit := TSynEdit.Create(self);
  with fSynEdit do
  begin
    Parent := TWinControl(self);
    Align := alClient;
  end;
  with fSynEdit do
    fSynEdit.Align := alClient;
    fSynEdit.Show;
    fSynEdit.Gutter.ShowLineNumbers:= true;
    fSynEdit.Gutter.Font.Name:= 'Times New Roman';
    fSynEdit.Highlighter:= Form1.SynHTMLSyn1;
    fSynEdit.lines.add ('<!doctype html public "-//W3C//DTD HTML 4.0 //EN">');
    { ... }
end;

procedure TForm1.AddNewTab(Caption : string);
var
  Sheet : TExtendedTabSheet;
begin
  Sheet := TExtendedTabSheet.Create(Pages);
  Sheet.PageControl := Pages;
  Sheet.Caption := Caption;
  Sheet.Show;
end;
  Mit Zitat antworten Zitat